bin/xbps-checkvers/main.c: buffer not NUL terminated (CID 62667)

This commit is contained in:
Juan RP 2014-10-05 07:55:27 +02:00
parent e5c341c6d2
commit 596a37defa

View File

@ -209,8 +209,10 @@ rcv_init(rcv_t *rcv, const char *prog)
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));
if (rcv->rootdir != NULL) if (rcv->rootdir != NULL) {
strncpy(rcv->xhp.rootdir, rcv->rootdir, sizeof(rcv->xhp.rootdir)); strncpy(rcv->xhp.rootdir, rcv->rootdir, XBPS_MAXPATH-1);
rcv->rootdir[XBPS_MAXPATH-1] = '\0';
}
xbps_init(&rcv->xhp); xbps_init(&rcv->xhp);
} }