Fix stringop-truncation error (thanks DJ Delorie)
See https://bugzilla.redhat.com/show_bug.cgi?id=1799189. bip build fails on current Fedora Rawhide GCC and glibc. DJ Delorie says "The warning is correct; the code is copying up to the NUL on purpose, then copying the NUL in a separate command. Not sure why." Tom Hughes suggests this as the fix.
This commit is contained in:
parent
c9cc64f2e1
commit
92819d87ea
@ -631,7 +631,7 @@ static char *get_str_elem(char *str, int num)
|
||||
if (c - cur < 1)
|
||||
return NULL;
|
||||
ret = bip_malloc(c - cur + 1);
|
||||
strncpy(ret, cur, c - cur);
|
||||
memcpy(ret, cur, c - cur);
|
||||
ret[c - cur] = 0;
|
||||
return ret;
|
||||
}
|
||||
@ -640,7 +640,7 @@ static char *get_str_elem(char *str, int num)
|
||||
if (c - cur < 1)
|
||||
return NULL;
|
||||
ret = bip_malloc(c - cur + 1);
|
||||
strncpy(ret, cur, c - cur);
|
||||
memcpy(ret, cur, c - cur);
|
||||
ret[c - cur] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user