1 |
vapier 11/10/03 16:19:18 |
2 |
|
3 |
Modified: scanelf.c xfuncs.h |
4 |
Log: |
5 |
fix off-by-one logic when adding strings to arrays |
6 |
|
7 |
Revision Changes Path |
8 |
1.233 pax-utils/scanelf.c |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/scanelf.c?rev=1.233&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/scanelf.c?rev=1.233&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/scanelf.c?r1=1.232&r2=1.233 |
13 |
|
14 |
Index: scanelf.c |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v |
17 |
retrieving revision 1.232 |
18 |
retrieving revision 1.233 |
19 |
diff -u -r1.232 -r1.233 |
20 |
--- scanelf.c 27 Sep 2011 22:20:07 -0000 1.232 |
21 |
+++ scanelf.c 3 Oct 2011 16:19:18 -0000 1.233 |
22 |
@@ -1,13 +1,13 @@ |
23 |
/* |
24 |
* Copyright 2003-2007 Gentoo Foundation |
25 |
* Distributed under the terms of the GNU General Public License v2 |
26 |
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.232 2011/09/27 22:20:07 vapier Exp $ |
27 |
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.233 2011/10/03 16:19:18 vapier Exp $ |
28 |
* |
29 |
* Copyright 2003-2007 Ned Ludd - <solar@g.o> |
30 |
* Copyright 2004-2007 Mike Frysinger - <vapier@g.o> |
31 |
*/ |
32 |
|
33 |
-static const char rcsid[] = "$Id: scanelf.c,v 1.232 2011/09/27 22:20:07 vapier Exp $"; |
34 |
+static const char rcsid[] = "$Id: scanelf.c,v 1.233 2011/10/03 16:19:18 vapier Exp $"; |
35 |
const char argv0[] = "scanelf"; |
36 |
|
37 |
#include "paxinc.h" |
38 |
@@ -1702,7 +1702,7 @@ |
39 |
if (*path != '/') |
40 |
continue; |
41 |
|
42 |
- xarraypush(ldpaths, path, strlen(path)); |
43 |
+ xarraypush_str(ldpaths, path); |
44 |
} |
45 |
free(path); |
46 |
|
47 |
@@ -1747,7 +1747,7 @@ |
48 |
while ((p = strsep(&b, ":"))) { |
49 |
if (*p == '\0') |
50 |
continue; |
51 |
- xarraypush(ldpaths, p, strlen(p)); |
52 |
+ xarraypush_str(ldpaths, p); |
53 |
} |
54 |
|
55 |
free(b); |
56 |
@@ -1974,7 +1974,7 @@ |
57 |
break; |
58 |
} |
59 |
case 'k': |
60 |
- xarraypush(find_section_arr, optarg, strlen(optarg)); |
61 |
+ xarraypush_str(find_section_arr, optarg); |
62 |
break; |
63 |
case 's': { |
64 |
if (find_sym) warn("You prob don't want to specify -s twice"); |
65 |
@@ -1982,7 +1982,7 @@ |
66 |
break; |
67 |
} |
68 |
case 'N': |
69 |
- xarraypush(find_lib_arr, optarg, strlen(optarg)); |
70 |
+ xarraypush_str(find_lib_arr, optarg); |
71 |
break; |
72 |
case 'F': { |
73 |
if (out_format) warn("You prob don't want to specify -F twice"); |
74 |
|
75 |
|
76 |
|
77 |
1.6 pax-utils/xfuncs.h |
78 |
|
79 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/xfuncs.h?rev=1.6&view=markup |
80 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/xfuncs.h?rev=1.6&content-type=text/plain |
81 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/pax-utils/xfuncs.h?r1=1.5&r2=1.6 |
82 |
|
83 |
Index: xfuncs.h |
84 |
=================================================================== |
85 |
RCS file: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v |
86 |
retrieving revision 1.5 |
87 |
retrieving revision 1.6 |
88 |
diff -u -r1.5 -r1.6 |
89 |
--- xfuncs.h 27 Sep 2011 18:37:22 -0000 1.5 |
90 |
+++ xfuncs.h 3 Oct 2011 16:19:18 -0000 1.6 |
91 |
@@ -1,7 +1,7 @@ |
92 |
/* |
93 |
* Copyright 2003-2007 Gentoo Foundation |
94 |
* Distributed under the terms of the GNU General Public License v2 |
95 |
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v 1.5 2011/09/27 18:37:22 vapier Exp $ |
96 |
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/xfuncs.h,v 1.6 2011/10/03 16:19:18 vapier Exp $ |
97 |
* |
98 |
* Copyright 2003-2007 Ned Ludd - <solar@g.o> |
99 |
* Copyright 2004-2007 Mike Frysinger - <vapier@g.o> |
100 |
@@ -25,6 +25,7 @@ |
101 |
size_t num; |
102 |
} array_t; |
103 |
void xarraypush(array_t *array, const void *ele, size_t ele_len); |
104 |
+#define xarraypush_str(arr, ele) xarraypush(arr, ele, strlen(ele) + 1 /*NUL*/) |
105 |
void xarrayfree(array_t *array); |
106 |
#define xrealloc_array(ptr, size, ele_size) xrealloc(ptr, (size) * (ele_size)) |
107 |
#define array_for_each(arr, n, ele) \ |