]> git.pld-linux.org Git - packages/rpm.git/blob - rpm-reduce-stack-usage.patch
a05fe4c43951e620452a56b64528bdc337b55394
[packages/rpm.git] / rpm-reduce-stack-usage.patch
1 --- rpm-4.4.1/rpmio/macro.c.orig        2005-01-26 04:39:58.000000000 +0100
2 +++ rpm-4.4.1/rpmio/macro.c     2005-04-10 23:25:02.000000000 +0200
3 @@ -924,7 +924,8 @@
4         /*@globals rpmGlobalMacroContext @*/
5         /*@modifies mb, rpmGlobalMacroContext @*/
6  {
7 -    char buf[BUFSIZ], *b, *be;
8 +    static char buf[BUFSIZ];
9 +    char *b, *be;
10      char aname[16];
11      const char *opts, *o;
12      int argc = 0;
13 @@ -1827,7 +1828,7 @@
14         return 0;
15      if (mc == NULL) mc = rpmGlobalMacroContext;
16  
17 -    tbuf = alloca(slen + 1);
18 +    tbuf = xmalloc(slen + 1);
19      memset(tbuf, 0, (slen + 1));
20  
21      mb->s = sbuf;
22 @@ -1847,6 +1848,7 @@
23  
24      tbuf[slen] = '\0'; /* XXX just in case */
25      strncpy(sbuf, tbuf, (slen - mb->nb + 1));
26 +    free(tbuf);
27  
28      return rc;
29  }
30 @@ -2091,7 +2093,8 @@
31  char * 
32  rpmExpand(const char *arg, ...)
33  {
34 -    char buf[BUFSIZ], *p, *pe;
35 +    static char buf[BUFSIZ];
36 +    char *p, *pe;
37      const char *s;
38      va_list ap;
39  
40 @@ -2229,7 +2232,7 @@
41  const char *
42  rpmGetPath(const char *path, ...)
43  {
44 -    char buf[BUFSIZ];
45 +    static char buf[BUFSIZ];
46      const char * s;
47      char * t, * te;
48      va_list ap;
This page took 0.088991 seconds and 3 git commands to generate.