Mercurial > libavformat.hg
changeset 2269:dfccc156e185 libavformat
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
author | benoit |
---|---|
date | Wed, 18 Jul 2007 07:57:26 +0000 |
parents | 8064e86dfe77 |
children | 1d4b38ae5f1b |
files | os_support.c |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/os_support.c Tue Jul 17 12:57:50 2007 +0000 +++ b/os_support.c Wed Jul 18 07:57:26 2007 +0000 @@ -46,16 +46,17 @@ 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;