]> git.pld-linux.org Git - packages/rpm.git/blob - rpm-CVE-2006-5466.patch
- updated for 4.4.8
[packages/rpm.git] / rpm-CVE-2006-5466.patch
1 Index: lib/query.c
2 ===================================================================
3 RCS file: /cvs/devel/rpm/lib/query.c,v
4 retrieving revision 2.173.2.15
5 retrieving revision 2.173.2.16
6 diff -a -u -r2.173.2.15 -r2.173.2.16
7 --- lib/query.c 8 Oct 2006 21:41:45 -0000       2.173.2.15
8 +++ lib/query.c 30 Oct 2006 02:50:53 -0000      2.173.2.16
9 @@ -124,6 +124,28 @@
10      return str;
11  }
12  
13 +/**
14 + */
15 +static void flushBuffer(char ** tp, char ** tep, int nonewline)
16 +       /*@ modifies *tp, *tep @*/
17 +{
18 +    char *t, *te;
19 +
20 +    t = *tp;
21 +    te = *tep;
22 +    if (te > t) {
23 +       if (!nonewline) {
24 +           *te++ = '\n';
25 +           *te = '\0';
26 +       }
27 +       rpmMessage(RPMMESS_NORMAL, "%s", t);
28 +       te = t;
29 +       *t = '\0';
30 +    }
31 +    *tp = t;
32 +    *tep = te;
33 +}
34 +
35  int showQueryPackage(QVA_t qva, rpmts ts, Header h)
36  {
37      int scareMem = 0;
38 @@ -131,7 +153,6 @@
39      char * t, * te;
40      char * prefix = NULL;
41      int rc = 0;                /* XXX FIXME: need real return code */
42 -    int nonewline = 0;
43      int i;
44  
45      te = t = xmalloc(BUFSIZ);
46 @@ -141,7 +162,6 @@
47  
48      if (qva->qva_queryFormat != NULL) {
49         const char * str = queryHeader(h, qva->qva_queryFormat);
50 -       nonewline = 1;
51         /*@-branchstate@*/
52         if (str) {
53             size_t tb = (te - t);
54 @@ -157,6 +177,7 @@
55             /*@=usereleased@*/
56  /*@=boundswrite@*/
57             str = _free(str);
58 +           flushBuffer(&t, &te, 1);
59         }
60         /*@=branchstate@*/
61      }
62 @@ -312,31 +333,13 @@
63                         _("package has neither file owner or id lists\n"));
64             }
65         }
66 -/*@-branchstate@*/
67 -       if (te > t) {
68 -/*@-boundswrite@*/
69 -           *te++ = '\n';
70 -           *te = '\0';
71 -           rpmMessage(RPMMESS_NORMAL, "%s", t);
72 -           te = t;
73 -           *t = '\0';
74 -/*@=boundswrite@*/
75 -       }
76 -/*@=branchstate@*/
77 +       flushBuffer(&t, &te, 0);
78      }
79             
80      rc = 0;
81  
82  exit:
83 -    if (te > t) {
84 -       if (!nonewline) {
85 -/*@-boundswrite@*/
86 -           *te++ = '\n';
87 -           *te = '\0';
88 -/*@=boundswrite@*/
89 -       }
90 -       rpmMessage(RPMMESS_NORMAL, "%s", t);
91 -    }
92 +    flushBuffer(&t, &te, 0);
93      t = _free(t);
94  
95      fi = rpmfiFree(fi);
This page took 0.032665 seconds and 3 git commands to generate.