[FFmpeg-devel] [PATCH] emulated inet_aton doesn't fail for invalid addresses

Michael Niedermayer michaelni
Sun Jul 15 10:41:35 CEST 2007


Hi

On Sun, Jul 15, 2007 at 12:40:49AM +0200, elupus wrote:
> Hi,
> 
> Emulated inet_aton doesn't fail for invalid addresses and always return 
> success. This makes resolve_host always give 0.0.0.0 address for any non 
> ipaddress.
> 
> /Joakim 

> Index: os_support.c
> ===================================================================
> --- os_support.c	(revision 9451)
> +++ os_support.c	(working copy)
> @@ -81,10 +81,13 @@
>      if (pch == 0 || ++pch == 0) goto done;
>      add4 = atoi(pch);
>  
> -done:
> +    if (!add1 || add1 > 255 || add2 > 255 || add3 > 255) goto done;

why no add4

and
if(!add1 || (add1|add2|add3|add4) > 255)
is simpler


> +
>      add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;

> +    return 1;
>  
> -    return 1;
cosmetic

> +done:
> +    return 0;

silly, just return 0 if you mean it dont goto to return 0

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070715/e25e9971/attachment.pgp>



More information about the ffmpeg-devel mailing list