<p>In src/command.c:</p>
<pre style='color:#555'>> @@ -124,6 +124,27 @@ char *cmd_list_profiles(void *self, char *argv[], int argc) {
>    return ret;
>  }
>  
> +/* Set link local ip */
> +char *cmd_generate_local_ip() {
> +
> +  unsigned char mac[6];
> +  memset(mac, '\0', sizeof(mac));
> +  
> +  char *address = malloc(16 * sizeof(char)); 
> +  memset(address, '\0', sizeof(address));
</pre>
<p>The 'sizeof' call is not the right way to get this value. It will only return the size of the pointer, not the size of what the pointer points to. Additionally, even if it did, sizeof is a precompiler macro, as such it can only work on types and other statically assigned values. Since 'address' is dynamically assigned, you need to use a function like 'strlen' or 'strnlen' to find the length of it.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/opentechinstitute/commotiond/pull/57/files#r8144208'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/HSS0tS4nfORw_XnPQF8f0RgukGV60lV2C8HB9ZrAlgZzLdBzDfTvecQSceX7Ez86.gif' height='1' width='1'></p>