... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue Sep 21 16:32:22 CEST 2010 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * sigtool/sigtool.c: don't use of sizeof() for malloc'ed buffer (bb#2283) |
|
4 |
+ |
|
1 | 5 |
Tue Sep 21 16:19:41 CEST 2010 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* clamdscan/proto.c: fix error path memleak (bb#2282) |
... | ... |
@@ -1662,10 +1662,10 @@ static int compare(const char *oldpath, const char *newpath, FILE *diff) |
1662 | 1662 |
fseek(old, opos, SEEK_SET); |
1663 | 1663 |
|
1664 | 1664 |
if(found) { |
1665 |
- strncpy(tbuff, obuff, sizeof(tbuff)); |
|
1666 |
- tbuff[sizeof(tbuff)-1]='\0'; |
|
1665 |
+ strncpy(tbuff, obuff, l1); |
|
1666 |
+ tbuff[l1-1]='\0'; |
|
1667 | 1667 |
for(i = 0; i < tline; i++) { |
1668 |
- tbuff[16] = 0; |
|
1668 |
+ tbuff[MIN(16, l1-1)] = 0; |
|
1669 | 1669 |
if((pt = strchr(tbuff, ' '))) |
1670 | 1670 |
*pt = 0; |
1671 | 1671 |
fprintf(diff, "DEL %u %s\n", oline + i, tbuff); |
... | ... |
@@ -1675,7 +1675,7 @@ static int compare(const char *oldpath, const char *newpath, FILE *diff) |
1675 | 1675 |
oline += tline; |
1676 | 1676 |
|
1677 | 1677 |
} else { |
1678 |
- obuff[16] = 0; |
|
1678 |
+ obuff[MIN(16, l1-1)] = 0; |
|
1679 | 1679 |
if((pt = strchr(obuff, ' '))) |
1680 | 1680 |
*pt = 0; |
1681 | 1681 |
fprintf(diff, "XCHG %u %s %s\n", oline, obuff, nbuff); |
... | ... |
@@ -1693,7 +1693,7 @@ static int compare(const char *oldpath, const char *newpath, FILE *diff) |
1693 | 1693 |
if(old) { |
1694 | 1694 |
while(fgets(obuff, l1, old)) { |
1695 | 1695 |
oline++; |
1696 |
- obuff[16] = 0; |
|
1696 |
+ obuff[MIN(16, l1-1)] = 0; |
|
1697 | 1697 |
if((pt = strchr(obuff, ' '))) |
1698 | 1698 |
*pt = 0; |
1699 | 1699 |
fprintf(diff, "DEL %u %s\n", oline, obuff); |