static analyzer bit in files.c
src/files.c(4403): warning: Reading invalid data from 'buf'.
This commit is contained in:
@@ -4396,12 +4396,14 @@ boolean
|
|||||||
copy_bytes(int ifd, int ofd)
|
copy_bytes(int ifd, int ofd)
|
||||||
{
|
{
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
int nfrom, nto;
|
int nfrom, nto = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
nfrom = read(ifd, buf, BUFSIZ);
|
nfrom = read(ifd, buf, BUFSIZ);
|
||||||
nto = write(ofd, buf, nfrom);
|
/* read can return -1 */
|
||||||
if (nto != nfrom)
|
if (nfrom >= 0 && nfrom <= BUFSIZ)
|
||||||
|
nto = write(ofd, buf, nfrom);
|
||||||
|
if (nto != nfrom || nfrom < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} while (nfrom == BUFSIZ);
|
} while (nfrom == BUFSIZ);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
Reference in New Issue
Block a user