From 08bcfb594bceff6d74bce2d8298239881cef8d7d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 5 Aug 2004 16:27:58 +0000 Subject: [PATCH] [BZ #295] Update. 2004-08-04 Jakub Jelinek * resolv/inet_pton.c (inet_pton4): Disallow octal numbers. Reported by A. Guru . [BZ #295] --- ChangeLog | 5 +++++ resolv/inet_pton.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5679173..a246a17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-08-04 Jakub Jelinek + + * resolv/inet_pton.c (inet_pton4): Disallow octal numbers. Reported + by A. Guru . [BZ #295] + 2004-08-05 Ulrich Drepper * po/nl.po: Update from translation team. diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c index 1a84835..c507013 100644 --- a/resolv/inet_pton.c +++ b/resolv/inet_pton.c @@ -69,7 +69,8 @@ libc_hidden_def (inet_pton) /* int * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal and shorthand. + * like inet_aton() but without all the hexadecimal, octal (with the + * exception of 0) and shorthand. * return: * 1 if `src' is a valid dotted quad, else 0. * notice: @@ -94,6 +95,8 @@ inet_pton4(src, dst) if (ch >= '0' && ch <= '9') { u_int new = *tp * 10 + (ch - '0'); + if (saw_digit && *tp == 0) + return (0); if (new > 255) return (0); *tp = new; -- 2.7.4