diff options
author | Benoit Fouet <benoit.fouet@free.fr> | 2007-07-19 10:48:50 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2007-07-19 10:48:50 +0000 |
commit | d72e7d0f24f1331c536f0d4aa41aaefceb41d921 (patch) | |
tree | ba0c89b1626cbcb930d92c585545aad9c7742cf5 /libavformat/os_support.c | |
parent | d04d5bcd0ed647a0cc7b278e3a4560e7e783798d (diff) | |
download | ffmpeg-d72e7d0f24f1331c536f0d4aa41aaefceb41d921.tar.gz |
use sscanf to parse address
Originally committed as revision 9756 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/os_support.c')
-rw-r--r-- | libavformat/os_support.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c index f1d0e0a8f1..65eb425eb3 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -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; |