git-svn: trunk@1545
Nigel Horne authored on 2005/05/14 04:30:34... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: binhex.c,v $ |
20 |
+ * Revision 1.15 2005/05/13 19:30:34 nigelhorne |
|
21 |
+ * Clean cli_realloc call |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.14 2005/03/10 08:51:30 nigelhorne |
21 | 24 |
* Tidy |
22 | 25 |
* |
... | ... |
@@ -57,7 +60,7 @@ |
57 | 57 |
* First draft of binhex.c |
58 | 58 |
* |
59 | 59 |
*/ |
60 |
-static char const rcsid[] = "$Id: binhex.c,v 1.14 2005/03/10 08:51:30 nigelhorne Exp $"; |
|
60 |
+static char const rcsid[] = "$Id: binhex.c,v 1.15 2005/05/13 19:30:34 nigelhorne Exp $"; |
|
61 | 61 |
|
62 | 62 |
#include "clamav.h" |
63 | 63 |
|
... | ... |
@@ -133,7 +136,7 @@ cli_binhex(const char *dir, int desc) |
133 | 133 |
|
134 | 134 |
while(bytesleft > 0) { |
135 | 135 |
int length = 0; |
136 |
- char *ptr; |
|
136 |
+ char *ptr, *newline; |
|
137 | 137 |
|
138 | 138 |
/*printf("%d: ", bytesleft);*/ |
139 | 139 |
|
... | ... |
@@ -144,7 +147,11 @@ cli_binhex(const char *dir, int desc) |
144 | 144 |
|
145 | 145 |
/*printf("%d: ", length);*/ |
146 | 146 |
|
147 |
- line = cli_realloc(line, (size_t)(length + 1)); |
|
147 |
+ newline = cli_realloc(line, (size_t)(length + 1)); |
|
148 |
+ if(newline == NULL) |
|
149 |
+ break; |
|
150 |
+ |
|
151 |
+ line = newline; |
|
148 | 152 |
|
149 | 153 |
memcpy(line, buf, length); |
150 | 154 |
line[length] = '\0'; |