From: Panu Matilainen Date: Fri, 1 Feb 2008 09:36:13 +0000 (+0200) Subject: Define + use MACROBUFSIZ for macro expansion buffer size X-Git-Tag: tznext/4.11.0.1.tizen20130304~4663 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54ab76019e8656950c9f9bf144edd549805dee0b;p=tools%2Flibrpm-tizen.git Define + use MACROBUFSIZ for macro expansion buffer size - double the buffer size while at it... --- diff --git a/rpmio/macro.c b/rpmio/macro.c index cef68bd..0d37937 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -12,6 +12,8 @@ #define STREQ(_t, _f, _fn) ((_fn) == (sizeof(_t)-1) && !strncmp((_t), (_f), (_fn))) +#define MACROBUFSIZ (BUFSIZ * 2) + #include #include #include @@ -479,7 +481,7 @@ expandU(MacroBuf mb, char * u, size_t ulen) static int doShellEscape(MacroBuf mb, const char * cmd, size_t clen) { - char pcmd[BUFSIZ]; + char pcmd[MACROBUFSIZ]; FILE *shf; int rc; int c; @@ -524,7 +526,7 @@ static const char * doDefine(MacroBuf mb, const char * se, int level, int expandbody) { const char *s = se; - char buf[BUFSIZ], *n = buf, *ne = n; + char buf[MACROBUFSIZ], *n = buf, *ne = n; char *o = NULL, *oe; char *b, *be; int c; @@ -640,7 +642,7 @@ static const char * doUndefine(rpmMacroContext mc, const char * se) { const char *s = se; - char buf[BUFSIZ], *n = buf, *ne = n; + char buf[MACROBUFSIZ], *n = buf, *ne = n; int c; COPYNAME(ne, s, c); @@ -781,7 +783,7 @@ static const char * grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se, const char * lastc) { - char buf[BUFSIZ], *b, *be; + char buf[MACROBUFSIZ], *b, *be; char aname[16]; const char *opts, *o; int argc = 0; @@ -925,7 +927,7 @@ grabArgs(MacroBuf mb, const rpmMacroEntry me, const char * se, static void doOutput(MacroBuf mb, int waserror, const char * msg, size_t msglen) { - char buf[BUFSIZ]; + char buf[MACROBUFSIZ]; if (msglen >= sizeof(buf)) { rpmlog(RPMLOG_ERR, _("Target buffer overflow\n")); @@ -953,7 +955,7 @@ static void doFoo(MacroBuf mb, int negate, const char * f, size_t fn, const char * g, size_t gn) { - char buf[BUFSIZ], *b = NULL, *be; + char buf[MACROBUFSIZ], *b = NULL, *be; int c; buf[0] = '\0'; @@ -1508,7 +1510,7 @@ int rpmLoadMacroFile(rpmMacroContext mc, const char * fn) { FD_t fd = Fopen(fn, "r.fpio"); - char buf[BUFSIZ]; + char buf[MACROBUFSIZ]; int rc = -1; if (fd == NULL || Ferror(fd)) { @@ -1615,7 +1617,7 @@ rpmFreeMacros(rpmMacroContext mc) char * rpmExpand(const char *arg, ...) { - char buf[BUFSIZ], *p, *pe; + char buf[MACROBUFSIZ], *p, *pe; const char *s; va_list ap;