mcexec: fix strncat missing NULL and pclose of uninitialized
Change-Id: I9ce4004580845a983949caa5668b2f950880cd24
This commit is contained in:
committed by
Masamichi Takagi
parent
661ba0ce4a
commit
1cea75dd51
@@ -1957,14 +1957,14 @@ opendev()
|
|||||||
fprintf(stderr, "%s: warning: LD_PRELOAD line is too long\n", __FUNCTION__); \
|
fprintf(stderr, "%s: warning: LD_PRELOAD line is too long\n", __FUNCTION__); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
strncat(envbuf, elembuf, remainder); \
|
strncat(envbuf, elembuf, remainder - 1); \
|
||||||
remainder = PATH_MAX - (strlen(envbuf) + 1); \
|
remainder = PATH_MAX - (strlen(envbuf) + 1); \
|
||||||
nelem++; \
|
nelem++; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static ssize_t find_libdir(char *libdir, size_t len)
|
static ssize_t find_libdir(char *libdir, size_t len)
|
||||||
{
|
{
|
||||||
FILE *filep;
|
FILE *filep = NULL;
|
||||||
ssize_t rc;
|
ssize_t rc;
|
||||||
size_t linelen = 0;
|
size_t linelen = 0;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
@@ -2020,7 +2020,9 @@ static ssize_t find_libdir(char *libdir, size_t len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
pclose(filep);
|
if (filep) {
|
||||||
|
pclose(filep);
|
||||||
|
}
|
||||||
free(line);
|
free(line);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user