This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi! This patch removes a bogus test which prevents e.g. %9[0-9] from working. Actually, I have no idea why the test was added there even if it was e.g. f - 1 or whatever, because if the test wants to guard against f[-2] being after the opening [, then this is already guaranteed. And at least if the *scanf character range is at least a little bit similar to shell patterns, then %[]-_] should match ], ^, _ characters and similarly with %[--/]. 2000-05-22 Jakub Jelinek <jakub@redhat.com> * stdio-common/vfscanf.c (__vfscanf): Remove bogus check if '-' is not the second character in the range. * stdio-common/tstscanf.c (main): Add testcase for the above. (Reported by jik@kamens.brookline.ma.us). --- libc/stdio-common/vfscanf.c.jj Wed Mar 22 22:36:09 2000 +++ libc/stdio-common/vfscanf.c Mon May 22 11:18:55 2000 @@ -1657,9 +1657,8 @@ __vfscanf (FILE *s, const char *format, ++f; } - tw = (char *) f; while ((fc = *f++) != '\0' && fc != ']') - if (fc == '-' && *f != '\0' && *f != ']' && f - 2 != tw + if (fc == '-' && *f != '\0' && *f != ']' && (unsigned char) f[-2] <= (unsigned char) *f) { /* Add all characters from the one before the '-' --- libc/stdio-common/tstscanf.c.jj Tue Jan 4 17:11:53 2000 +++ libc/stdio-common/tstscanf.c Mon May 22 11:24:03 2000 @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 96, 97, 98, 99 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,6 +34,13 @@ main (int argc, char **argv) int result = 0; if (sscanf ("0", "%d", &x) != 1) + { + fputs ("test failed!\n", stdout); + result = 1; + } + + if (sscanf ("08905x", "%9[0-9]", buf) != 1 + || strcmp (buf, "08905") != 0) { fputs ("test failed!\n", stdout); result = 1; Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |