git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@67 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2003/09/30 02:11:35... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Mon Sep 29 18:10:39 BST 2003 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: moved stub from heap to stack since its mazimum size is known |
|
4 |
+ |
|
1 | 5 |
Mon Sep 29 13:59:13 BST 2003 (njh) |
2 | 6 |
--------------------------------- |
3 | 7 |
* libclamav: Handle Content-Type: /; name="eicar.com" |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.12 2003/09/29 17:10:19 nigelhorne |
|
21 |
+ * Moved stub from heap to stack since its maximum size is known |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.11 2003/09/29 12:58:32 nigelhorne |
21 | 24 |
* Handle Content-Type: /; name="eicar.com" |
22 | 25 |
* |
... | ... |
@@ -24,7 +27,7 @@ |
24 | 24 |
* Compilable under SCO; removed duplicate code with message.c |
25 | 25 |
* |
26 | 26 |
*/ |
27 |
-static char const rcsid[] = "$Id: mbox.c,v 1.11 2003/09/29 12:58:32 nigelhorne Exp $"; |
|
27 |
+static char const rcsid[] = "$Id: mbox.c,v 1.12 2003/09/29 17:10:19 nigelhorne Exp $"; |
|
28 | 28 |
|
29 | 29 |
#ifndef CL_DEBUG |
30 | 30 |
/*#define NDEBUG /* map CLAMAV debug onto standard */ |
... | ... |
@@ -1446,8 +1449,9 @@ saveFile(const blob *b, const char *dir) |
1446 | 1446 |
* should be independant of their usage on UNIX type systems. |
1447 | 1447 |
*/ |
1448 | 1448 |
if(strlen(suffix) > 1) { |
1449 |
- char *stub = strdup(filename); |
|
1449 |
+ char stub[NAME_MAX + 1]; |
|
1450 | 1450 |
|
1451 |
+ strcpy(stub, filename); |
|
1451 | 1452 |
strcat(filename, suffix); |
1452 | 1453 |
#ifdef C_LINUX |
1453 | 1454 |
rename(stub, filename); |
... | ... |
@@ -1455,7 +1459,6 @@ saveFile(const blob *b, const char *dir) |
1455 | 1455 |
link(stub, filename); |
1456 | 1456 |
unlink(stub); |
1457 | 1457 |
#endif |
1458 |
- free(stub); |
|
1459 | 1458 |
} |
1460 | 1459 |
|
1461 | 1460 |
write(fd, blobGetData(b), (size_t)nbytes); |