Merge pull request #38 from Gottox/master
libxbps: use strlcpy instead of strncpy
This commit is contained in:
commit
8920149a06
@ -180,7 +180,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested, bool vpkgconf
|
|||||||
size_t len, nlines = 0;
|
size_t len, nlines = 0;
|
||||||
ssize_t read;
|
ssize_t read;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
char ocwd[XBPS_MAXPATH], tmppath[XBPS_MAXPATH];
|
char ocwd[XBPS_MAXPATH] = { 0 }, tmppath[XBPS_MAXPATH] = { 0 };
|
||||||
char *cwd;
|
char *cwd;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ parse_file(struct xbps_handle *xhp, const char *path, bool nested, bool vpkgconf
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* cwd to the dir containing the config file */
|
/* cwd to the dir containing the config file */
|
||||||
strncpy(tmppath, path, sizeof(tmppath));
|
strlcpy(tmppath, path, sizeof(tmppath));
|
||||||
cwd = dirname(tmppath);
|
cwd = dirname(tmppath);
|
||||||
if (getcwd(ocwd, sizeof(ocwd)) == NULL) {
|
if (getcwd(ocwd, sizeof(ocwd)) == NULL) {
|
||||||
rv = errno;
|
rv = errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user