forked from old/legacy-imlib2
imlib2_conv.c: Fix gcc8 warning
imlib2_conv.c: In function ‘main’: imlib2_conv.c:64:14: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] strncpy(p, dot, (strlen(dot) < 9) ? strlen(dot) : 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ imlib2_conv.c:64:31: note: length computed here strncpy(p, dot, (strlen(dot) < 9) ? strlen(dot) : 8); ^~~~~~~~~~~
This commit is contained in:
parent
4d6ff056ef
commit
d0da3117e9
|
@ -59,11 +59,9 @@ main(int argc, char **argv)
|
|||
char *p, *q;
|
||||
|
||||
/* max length of 8 for format name. seems reasonable. */
|
||||
q = p = malloc(9);
|
||||
memset(p, 0, 8);
|
||||
strncpy(p, dot, (strlen(dot) < 9) ? strlen(dot) : 8);
|
||||
p = strndup(dot, 8);
|
||||
/* Imlib2 only recognizes lowercase formats. convert it. */
|
||||
for (q[8] = 0; *q; q++)
|
||||
for (q = p; *q; q++)
|
||||
*q = tolower(*q);
|
||||
imlib_image_set_format(p);
|
||||
free(p);
|
||||
|
|
Loading…
Reference in New Issue