xbps-pkgdb: play safe with strncpy().
--HG-- extra : convert_revision : 3562b4d657e4c10fdf734d149eec0bd6f36793f8
This commit is contained in:
parent
5722c8aca1
commit
9b3481a3b6
1 changed files with 2 additions and 2 deletions
|
@ -175,13 +175,13 @@ main(int argc, char **argv)
|
|||
|
||||
if ((dbfileenv = getenv("XBPS_REGPKGDB_PATH")) != NULL) {
|
||||
/* Use path as defined by XBPS_REGPKGDB_PATH env var */
|
||||
tmppath = strncpy(dbfile, dbfileenv, sizeof(dbfile));
|
||||
tmppath = strncpy(dbfile, dbfileenv, sizeof(dbfile) - 1);
|
||||
if (sizeof(*tmppath) >= sizeof(dbfile))
|
||||
exit(1);
|
||||
} else {
|
||||
/* Use default path */
|
||||
tmppath =
|
||||
strncpy(dbfile, XBPS_REGPKGDB_DEFPATH, sizeof(dbfile));
|
||||
strncpy(dbfile, XBPS_REGPKGDB_DEFPATH, sizeof(dbfile) - 1);
|
||||
if (sizeof(*tmppath) >= sizeof(dbfile))
|
||||
exit(1);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue