[FFmpeg-cvslog] r9731 - trunk/libavformat/os_support.c

benoit subversion
Wed Jul 18 09:57:26 CEST 2007


Author: benoit
Date: Wed Jul 18 09:57:26 2007
New Revision: 9731

Log:
fix emulated inet_aton so that it fails for invalid addresses
patch by elupus: \elupus ecce se/
original thread:
[FFmpeg-devel] [PATCH] emulated inet_aton doesn't fail for invalidaddresses
date: 07/15/2007 12:40 AM


Modified:
   trunk/libavformat/os_support.c

Modified: trunk/libavformat/os_support.c
==============================================================================
--- trunk/libavformat/os_support.c	(original)
+++ trunk/libavformat/os_support.c	Wed Jul 18 09:57:26 2007
@@ -46,16 +46,17 @@ int inet_aton (const char * str, struct 
 
     add1 = atoi(pch);
     pch = strpbrk(pch,".");
-    if (pch == 0 || ++pch == 0) goto done;
+    if (pch == 0 || ++pch == 0) return 0;
     add2 = atoi(pch);
     pch = strpbrk(pch,".");
-    if (pch == 0 || ++pch == 0) goto done;
+    if (pch == 0 || ++pch == 0) return 0;
     add3 = atoi(pch);
     pch = strpbrk(pch,".");
-    if (pch == 0 || ++pch == 0) goto done;
+    if (pch == 0 || ++pch == 0) return 0;
     add4 = atoi(pch);
 
-done:
+    if (!add1 || (add1|add2|add3|add4) > 255) return 0;
+
     add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
 
     return 1;




More information about the ffmpeg-cvslog mailing list