mediastream.c: use strtol instead of atoi because of Windows not handling ERANGE

parent a5c3829d
......@@ -1212,14 +1212,14 @@ static bool_t parse_addr(const char *addr, char *ip, int len, int *port)
}
/*if no semicolon is present, we can assume that user provided only port*/
if (semicolon==NULL) {
*port = atoi(addr);
if (*port != ERANGE) {
const char *localhost = "127.0.0.1";
strncpy(ip,localhost, MIN(len, strlen(localhost)));
return TRUE;
} else {
const char *localhost = "127.0.0.1";
char * end;
*port = strtol(addr, &end, 10);
if (*end != '\0' || end == addr) {
return FALSE;
}
strncpy(ip,localhost, MIN(len, strlen(localhost)));
return TRUE;
}
iplen=semicolon-addr;
slen=MIN(iplen,len-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment