bin/xbps-checkvers/main.c: fix CID 62667 (2/2)

This commit is contained in:
Juan RP 2014-10-05 09:56:42 +02:00
parent d006d60497
commit 14da590f41

View File

@ -207,11 +207,13 @@ rcv_init(rcv_t *rcv, const char *prog)
rcv->prog = prog; rcv->prog = prog;
rcv->have_vars = 0; rcv->have_vars = 0;
rcv->ptr = rcv->input = NULL; rcv->ptr = rcv->input = NULL;
if (rcv->xbps_conf != NULL) if (rcv->xbps_conf != NULL) {
strncpy(rcv->xhp.conffile, rcv->xbps_conf, sizeof(rcv->xhp.conffile)); 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) { if (rcv->rootdir != NULL) {
strncpy(rcv->xhp.rootdir, rcv->rootdir, XBPS_MAXPATH-1); strncpy(rcv->xhp.rootdir, rcv->rootdir, sizeof(rcv->xhp.rootdir)-1);
rcv->xhp.rootdir[XBPS_MAXPATH-1] = '\0'; rcv->xhp.rootdir[sizeof(rcv->xhp.rootdir)-1] = '\0';
} }
xbps_init(&rcv->xhp); xbps_init(&rcv->xhp);
} }