summaryrefslogtreecommitdiffstats
path: root/misc/bidwatcher
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2003-01-18 18:57:12 +0000
committerobrien <obrien@FreeBSD.org>2003-01-18 18:57:12 +0000
commit61c7f8c74889c7b46b7ffa3062012046254c3763 (patch)
treef622605d336dcd1d4412a0bd7b8cb4243538859f /misc/bidwatcher
parent4c57bd7d215936db85ea768f55e41c85a991cd77 (diff)
downloadFreeBSD-ports-61c7f8c74889c7b46b7ffa3062012046254c3763.zip
FreeBSD-ports-61c7f8c74889c7b46b7ffa3062012046254c3763.tar.gz
StripAndTab() poorly designed for "". It is possible for it to get
called on a zero length string and the code assumes this is not possible. Reviewed by: Kevin Dwyer <kevindication> (Bidwatcher author)
Diffstat (limited to 'misc/bidwatcher')
-rw-r--r--misc/bidwatcher/files/patch-helpers.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/misc/bidwatcher/files/patch-helpers.cpp b/misc/bidwatcher/files/patch-helpers.cpp
new file mode 100644
index 0000000..525eff1
--- /dev/null
+++ b/misc/bidwatcher/files/patch-helpers.cpp
@@ -0,0 +1,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=='<') {
OpenPOWER on IntegriCloud