about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-05 16:27:58 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-05 16:27:58 +0000
commit08bcfb594bceff6d74bce2d8298239881cef8d7d (patch)
treea17c53de90a729cb7b82f913a0dd045451abda25
parent2f0cdd2b9e41f4141c8e60584efe2fea81a9dad0 (diff)
downloadglibc-08bcfb594bceff6d74bce2d8298239881cef8d7d.tar.gz
glibc-08bcfb594bceff6d74bce2d8298239881cef8d7d.tar.xz
glibc-08bcfb594bceff6d74bce2d8298239881cef8d7d.zip
[BZ #295]
Update.
2004-08-04  Jakub Jelinek  <jakub@redhat.com>

	* resolv/inet_pton.c (inet_pton4): Disallow octal numbers.  Reported
	by A. Guru <a.guru@sympatico.ca>.  [BZ #295]
-rw-r--r--ChangeLog5
-rw-r--r--resolv/inet_pton.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 56791738bf..a246a17e49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-04  Jakub Jelinek  <jakub@redhat.com>
+
+	* resolv/inet_pton.c (inet_pton4): Disallow octal numbers.  Reported
+	by A. Guru <a.guru@sympatico.ca>.  [BZ #295]
+
 2004-08-05  Ulrich Drepper  <drepper@redhat.com>
 
 	* po/nl.po: Update from translation team.
diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c
index 1a848350f2..c507013e4e 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;