Commit d72e7d0f authored by Benoit Fouet's avatar Benoit Fouet

use sscanf to parse address

Originally committed as revision 9756 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent d04d5bcd
......@@ -41,19 +41,10 @@
int inet_aton (const char * str, struct in_addr * add)
{
const char * pch = str;
unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
add1 = atoi(pch);
pch = strpbrk(pch,".");
if (!pch) return 0;
add2 = atoi(pch);
pch = strpbrk(pch,".");
if (!pch) return 0;
add3 = atoi(pch);
pch = strpbrk(pch,".");
if (!pch) return 0;
add4 = atoi(pch);
if (sscanf(str, "%d.%d.%d.%d", &add1, &add2, &add3, &add4) != 4)
return 0;
if (!add1 || (add1|add2|add3|add4) > 255) return 0;
......
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