1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-29 10:59:02 +00:00

In xml_convert, handle the case when repl is the empty string on the

first iteration. This can't happen with the current data definitions,
but if it did it would result in memcpy being passed a null pointer.
(memcpy would be asked to do a zero-byte copy, so it would probably be
okay anyway, but it's better to be safe.)
This commit is contained in:
david
2009-08-24 18:10:12 +00:00
parent a02756a5e4
commit 6bd9760f3b

View File

@@ -912,7 +912,7 @@ char *xml_convert(const char *str) {
len = strlen(repl);
/* Double the size of the result buffer if necessary. */
if (i + len > n) {
if (i == 0 || i + len > n) {
n = (i + len) * 2;
result = (char *) safe_realloc(result, n + 1);
}