From 14da590f411449725012d304d1fa94d436a32638 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 5 Oct 2014 09:56:42 +0200 Subject: [PATCH] bin/xbps-checkvers/main.c: fix CID 62667 (2/2) --- bin/xbps-checkvers/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bin/xbps-checkvers/main.c b/bin/xbps-checkvers/main.c index 4a5b477c..13a303b2 100644 --- a/bin/xbps-checkvers/main.c +++ b/bin/xbps-checkvers/main.c @@ -207,11 +207,13 @@ rcv_init(rcv_t *rcv, const char *prog) rcv->prog = prog; rcv->have_vars = 0; rcv->ptr = rcv->input = NULL; - if (rcv->xbps_conf != NULL) - strncpy(rcv->xhp.conffile, rcv->xbps_conf, sizeof(rcv->xhp.conffile)); + if (rcv->xbps_conf != NULL) { + strncpy(rcv->xhp.conffile, rcv->xbps_conf, sizeof(rcv->xhp.conffile)-1); + rcv->xhp.conffile[sizeof(rcv->xhp.conffile)-1] = '\0'; + } if (rcv->rootdir != NULL) { - strncpy(rcv->xhp.rootdir, rcv->rootdir, XBPS_MAXPATH-1); - rcv->xhp.rootdir[XBPS_MAXPATH-1] = '\0'; + strncpy(rcv->xhp.rootdir, rcv->rootdir, sizeof(rcv->xhp.rootdir)-1); + rcv->xhp.rootdir[sizeof(rcv->xhp.rootdir)-1] = '\0'; } xbps_init(&rcv->xhp); }