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:
parent
0ff7575499
commit
723f2f7b2a
@ -418,8 +418,10 @@ mapped_v4_to_regular_v4(char *str)
|
|||||||
int prefix_len;
|
int prefix_len;
|
||||||
|
|
||||||
prefix_len = strlen(prefix);
|
prefix_len = strlen(prefix);
|
||||||
if (strncmp(str, prefix, prefix_len) == 0)
|
if (strncmp(str, prefix, prefix_len) == 0) {
|
||||||
strcpy(str, str+prefix_len);
|
int str_len = strlen(str);
|
||||||
|
memmove(str, str + prefix_len, str_len - prefix_len + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user