[syslinux:master] com32: fix range handling in vsscanf
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Mon Apr 4 10:33:54 PDT 2011
Commit-ID: 61565f3994e672607f6a00ae7a72373251d8f9e6
Gitweb: http://syslinux.zytor.com/commit/61565f3994e672607f6a00ae7a72373251d8f9e6
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 4 Apr 2011 10:31:09 -0700
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 4 Apr 2011 10:31:09 -0700
com32: fix range handling in vsscanf
Fix multiple errors in building the bitmap for ranges in %[.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
com32/lib/vsscanf.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/com32/lib/vsscanf.c b/com32/lib/vsscanf.c
index 751f22a..9d4c721 100644
--- a/com32/lib/vsscanf.c
+++ b/com32/lib/vsscanf.c
@@ -20,9 +20,8 @@
enum flags {
FL_SPLAT = 0x01, /* Drop the value, do not assign */
- FL_INV = 0x02, /* Character-set with inverse */
- FL_WIDTH = 0x04, /* Field width specified */
- FL_MINUS = 0x08, /* Negative number */
+ FL_WIDTH = 0x02, /* Field width specified */
+ FL_MINUS = 0x04, /* Negative number */
};
enum ranks {
@@ -295,9 +294,10 @@ set_integer:
break;
case st_match_init: /* Initial state for %[ match */
- if (ch == '^' && !(flags & FL_INV)) {
+ if (ch == '^' && !matchinv) {
matchinv = 1;
} else {
+ range_start = (unsigned char)ch;
set_bit((unsigned char)ch, matchmap);
state = st_match;
}
@@ -307,9 +307,9 @@ set_integer:
if (ch == ']') {
goto match_run;
} else if (ch == '-') {
- range_start = (unsigned char)ch;
state = st_match_range;
} else {
+ range_start = (unsigned char)ch;
set_bit((unsigned char)ch, matchmap);
}
break;
@@ -320,7 +320,7 @@ set_integer:
goto match_run;
} else {
int i;
- for (i = range_start; i < (unsigned char)ch; i++)
+ for (i = range_start; i <= (unsigned char)ch; i++)
set_bit(i, matchmap);
state = st_match;
}
More information about the Syslinux-commits
mailing list