From 3e991bc40c4f7818d720649901993cec95056540 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 5 May 2008 11:53:48 +0300 Subject: [PATCH] Eliminate static sized string buffer in parseScript() --- build/parseScript.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/parseScript.c b/build/parseScript.c index 3e73b52..a2e6764 100644 --- a/build/parseScript.c +++ b/build/parseScript.c @@ -86,7 +86,7 @@ int parseScript(rpmSpec spec, int parsePart) StringBuf sb = NULL; int nextPart; int index; - char reqargs[BUFSIZ]; + char * reqargs = NULL; int res = PART_ERROR; /* assume failure */ int rc, argc; @@ -94,7 +94,6 @@ int parseScript(rpmSpec spec, int parsePart) const char **argv = NULL; poptContext optCon = NULL; - reqargs[0] = '\0'; name = NULL; prog = "/bin/sh"; file = NULL; @@ -182,13 +181,13 @@ int parseScript(rpmSpec spec, int parsePart) } *p = '\0'; - strcpy(reqargs, p + 2); + reqargs = xstrdup(p + 2); } if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { rpmlog(RPMLOG_ERR, _("line %d: Error parsing %s: %s\n"), spec->lineNum, partname, poptStrerror(rc)); - return PART_ERROR; + goto exit; } optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); @@ -345,6 +344,7 @@ int parseScript(rpmSpec spec, int parsePart) res = nextPart; exit: + free(reqargs); sb = freeStringBuf(sb); progArgv = _free(progArgv); argv = _free(argv); -- 2.7.4