[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] [BUG][PATCH] Too few memory allocated...
Hi,
when looking at ns with dmalloc, I found a bug (writing beyond the
end of allocated memory for hierarchical addresses ...).
I checked the ns directory completely for occurences of
'new ... [strlen...]' and found nothing more than this single one.
Patch appended.
Regards,
/J"org
--------------------
--- ns/simulator.cc.orig Mon Jan 7 09:43:04 2002
+++ ns/simulator.cc Mon Jan 7 09:43:08 2002
@@ -220,7 +220,7 @@
sprintf(tmp, "%d.",addr[i-2]);
strcat(a, tmp);
}
- str = new char[strlen(a)];
+ str = new char[strlen(a) + 1];
strcpy(str, a);
return (str);
}