mirror of
https://github.com/void-linux/void-packages.git
synced 2025-08-01 10:22:56 +02:00
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) {
|
if ((dbfileenv = getenv("XBPS_REGPKGDB_PATH")) != NULL) {
|
||||||
/* Use path as defined by XBPS_REGPKGDB_PATH env var */
|
/* 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))
|
if (sizeof(*tmppath) >= sizeof(dbfile))
|
||||||
exit(1);
|
exit(1);
|
||||||
} else {
|
} else {
|
||||||
/* Use default path */
|
/* Use default path */
|
||||||
tmppath =
|
tmppath =
|
||||||
strncpy(dbfile, XBPS_REGPKGDB_DEFPATH, sizeof(dbfile));
|
strncpy(dbfile, XBPS_REGPKGDB_DEFPATH, sizeof(dbfile) - 1);
|
||||||
if (sizeof(*tmppath) >= sizeof(dbfile))
|
if (sizeof(*tmppath) >= sizeof(dbfile))
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue