From 9b3481a3b63af8b01a4f41b787b4425338cb6822 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 21 Dec 2008 02:11:41 +0100 Subject: [PATCH] xbps-pkgdb: play safe with strncpy(). --HG-- extra : convert_revision : 3562b4d657e4c10fdf734d149eec0bd6f36793f8 --- utils/xbps-pkgdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/xbps-pkgdb.c b/utils/xbps-pkgdb.c index 502d79779fa..9603b8ef486 100644 --- a/utils/xbps-pkgdb.c +++ b/utils/xbps-pkgdb.c @@ -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); }