aboutsummaryrefslogtreecommitdiff
path: root/misc/bidwatcher/files/patch-helpers.cpp
blob: 525eff1e2e7e3e82c4d992ebffc40dcf00ed7c5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--- helpers.cpp.orig	Sat Dec 21 00:00:42 2002
+++ helpers.cpp	Sun Dec 29 09:31:01 2002
@@ -344,13 +344,16 @@
 //////////////////////////////////////////////////////////////////////
 char * StripAndTab(const char * stringToStrip)
 {
-  char *Buff=(char *)malloc(strlen(stringToStrip));
-  Buff[0]='\0';
   int buffLength = strlen(stringToStrip);
   int BuffIdx = 0;
   int u,c;
   int IncludeFlag = 5;
   bool tabFlag = FALSE;
+  if (!buffLength) {
+    ++buffLength;	// some malloc's don't handled malloc(0) well
+  }
+  char *Buff=(char *)malloc(buffLength);
+  Buff[0]='\0';
   for (u = 0; (u < buffLength);u++) {
     c = stringToStrip[u];
     if (c=='<') {