rpmio: fix potential buffer overflow in Fdopen
In file included from /usr/include/string.h:648:0, from ../system.h:76, from rpmio.c:6: In function 'strncat', inlined from 'Fdopen' at rpmio.c:3473:5: /usr/include/bits/string3.h:158:10: warning: call to __builtin___strncat_chk might overflow destination buffer return __builtin___strncat_chk (__dest, __src, __len, __bos (__dest));
This commit is contained in:
parent
509272d41b
commit
4ab56b3647
@ -3470,8 +3470,8 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n", fd, fmode, fdbg(fd));
|
||||
if (stdio[0] == '\0')
|
||||
return NULL;
|
||||
zstdio[0] = '\0';
|
||||
strncat(zstdio, stdio, sizeof(zstdio) - strlen(zstdio));
|
||||
strncat(zstdio, other, sizeof(zstdio) - strlen(zstdio));
|
||||
strncat(zstdio, stdio, sizeof(zstdio) - 1 - strlen(zstdio));
|
||||
strncat(zstdio, other, sizeof(zstdio) - 1 - strlen(zstdio));
|
||||
|
||||
if (end == NULL && other[0] == '\0')
|
||||
/*@-refcounttrans -retalias@*/ return fd; /*@=refcounttrans =retalias@*/
|
||||
|
Loading…
Reference in New Issue
Block a user