Fix an abort observed on MacOS X 10.9 (but applicable to other platforms).

mapped_v4_to_regular_v4() committed the sin of doing strcpy(3) on
overlapping buffers.  This caused an abort on MacOS X 10.9.  Fix this
to use memcpy(3) instead, which handles overlapping buffers correctly.

Issue:		135 (Crash on OS X when using IP address)
This commit is contained in:
Bruce A. Mah 2014-01-21 12:59:47 -08:00
parent 0ff7575499
commit 723f2f7b2a

View File

@ -418,8 +418,10 @@ mapped_v4_to_regular_v4(char *str)
int prefix_len;
prefix_len = strlen(prefix);
if (strncmp(str, prefix, prefix_len) == 0)
strcpy(str, str+prefix_len);
if (strncmp(str, prefix, prefix_len) == 0) {
int str_len = strlen(str);
memmove(str, str + prefix_len, str_len - prefix_len + 1);
}
}
void