]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-refcnt-overflow.patch
- add "dir" alias
[packages/poldek.git] / poldek-refcnt-overflow.patch
1 Index: pkgmark.c
2 ===================================================================
3 RCS file: /cvsroot/poldek/poldek/pkgmark.c,v
4 retrieving revision 1.7
5 diff -u -r1.7 pkgmark.c
6 --- pkgmark.c   12 Jun 2005 20:17:13 -0000      1.7
7 +++ pkgmark.c   11 Sep 2006 21:35:51 -0000
8 @@ -145,6 +145,7 @@
9      const char *id;
10      
11      id = package_id(idbuf, sizeof(idbuf), pmark, pkg);
12 +    n_assert(id);
13  
14      if ((pkg_mark = n_hash_get(pmark->ht, id)))
15          return pkg_mark->flags & flag;
16 Index: pkg.c
17 ===================================================================
18 RCS file: /cvsroot/poldek/poldek/pkg.c,v
19 retrieving revision 1.111
20 diff -u -r1.111 pkg.c
21 --- pkg.c       20 Aug 2006 21:13:19 -0000      1.111
22 +++ pkg.c       11 Sep 2006 21:35:53 -0000
23 @@ -1380,7 +1380,8 @@
24               pkg->na ? pkg->na->_refcnt : -1,
25               pkg->_refcnt, &pkg->_refcnt);
26      }
27 -#endif    
28 +#endif
29 +    n_assert(pkg->_refcnt < INT16_MAX - 1);
30      pkg->_refcnt++;
31      return pkg;
32  }
33 Index: pkgset-req.c
34 ===================================================================
35 RCS file: /cvsroot/poldek/poldek/pkgset-req.c,v
36 retrieving revision 1.45
37 diff -u -r1.45 pkgset-req.c
38 --- pkgset-req.c        20 Aug 2006 21:13:19 -0000      1.45
39 +++ pkgset-req.c        11 Sep 2006 21:35:54 -0000
40 @@ -332,13 +332,24 @@
41          } else {                /* n is 0 */
42              tn_array *pkgs;
43              if ((pkgs = pkgset_search_reqdir(ps, NULL, reqname))) {
44 +                int i;
45                  n = 0;
46 +
47 +                for (i=0; i < n_array_size(pkgs); i++) {
48 +                    pkgsbuf[n++] = n_array_nth(pkgs, i);
49 +                    if (n == pkgsbuf_size)
50 +                        break;
51 +                }
52 +
53 +/* XXX: TOFIX: pkgsbuf is not free()d by caller, so pkg _refcnts must
54 +   be decreased here */
55 +#if 0  
56                  while (n_array_size(pkgs)) {
57                      pkgsbuf[n++] = n_array_shift(pkgs);
58                      if (n == pkgsbuf_size)
59                          break;
60                  }
61 -                
62 +#endif                
63                  *npkgs = n;
64                  if (n) {
65                      matched = 1;
This page took 0.026453 seconds and 3 git commands to generate.