diff --git a/build/parseSpec.c b/build/parseSpec.c index d2ee92235..4993fffe8 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -203,7 +203,7 @@ static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi) /* Don't expand macros (eg. %define) in false branch of %if clause */ if (spec->readStack->reading && - expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) { + expandMacros(spec, spec->macros, spec->lbuf, spec->lbufSize)) { rpmlog(RPMLOG_ERR, _("line %d: %s\n"), spec->lineNum, spec->lbuf); return -1; diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h index 50ddbe3a9..96f00288a 100644 --- a/build/rpmbuild_internal.h +++ b/build/rpmbuild_internal.h @@ -41,7 +41,8 @@ struct rpmSpec_s { const char * rootDir; struct OpenFileInfo * fileStack; - char lbuf[10*BUFSIZ]; + char *lbuf; + size_t lbufSize; size_t lbufOff; char nextpeekc; char * nextline; diff --git a/build/spec.c b/build/spec.c index 00e4e6d3a..4b6b6805d 100644 --- a/build/spec.c +++ b/build/spec.c @@ -160,6 +160,8 @@ rpmSpec newSpec(void) spec->specFile = NULL; spec->fileStack = NULL; + spec->lbufSize = BUFSIZ * 10; + spec->lbuf = xmalloc(spec->lbufSize); spec->lbuf[0] = '\0'; spec->line = spec->lbuf; spec->nextline = NULL; @@ -237,6 +239,7 @@ rpmSpec rpmSpecFree(rpmSpec spec) rl->next = NULL; free(rl); } + spec->lbuf = _free(spec->lbuf); spec->sourceRpmName = _free(spec->sourceRpmName); spec->sourcePkgId = _free(spec->sourcePkgId);