From: Paul Nasrat Date: Mon, 16 Apr 2007 12:14:17 +0000 (+0100) Subject: Fix segfault when rpmbuild stumbles over an empty file list. X-Git-Tag: rpm-4.4.2.1-rc1~115 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5fdd5efb26d67e89c5d1cda51435de2896348102;p=platform%2Fupstream%2Frpm.git Fix segfault when rpmbuild stumbles over an empty file list. The "+ 1" is a remedy for xmalloc(0), which would return NULL. Patch from OpenSuSE --- diff --git a/build/files.c b/build/files.c index f1d6a19..c38b0d3 100644 --- a/build/files.c +++ b/build/files.c @@ -1392,7 +1392,7 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl, : (int *)(fi->bnl + fi->fc); /*@=dependenttrans@*/ - fi->apath = xmalloc(fi->fc * sizeof(*fi->apath) + apathlen); + fi->apath = xmalloc(fi->fc * sizeof(*fi->apath) + apathlen + 1); a = (char *)(fi->apath + fi->fc); *a = '\0';