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;
|
char *p, *q;
|
||||||
|
|
||||||
/* max length of 8 for format name. seems reasonable. */
|
/* max length of 8 for format name. seems reasonable. */
|
||||||
q = p = malloc(9);
|
p = strndup(dot, 8);
|
||||||
memset(p, 0, 8);
|
|
||||||
strncpy(p, dot, (strlen(dot) < 9) ? strlen(dot) : 8);
|
|
||||||
/* Imlib2 only recognizes lowercase formats. convert it. */
|
/* Imlib2 only recognizes lowercase formats. convert it. */
|
||||||
for (q[8] = 0; *q; q++)
|
for (q = p; *q; q++)
|
||||||
*q = tolower(*q);
|
*q = tolower(*q);
|
||||||
imlib_image_set_format(p);
|
imlib_image_set_format(p);
|
||||||
free(p);
|
free(p);
|
||||||
|
|
Loading…
Reference in New Issue