| Anonymous | Login | Signup for a new account | 11-10-2008 11:21 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
| 0001577 | [uClibc] Other | trivial | always | 11-07-07 02:44 | 06-02-08 16:22 | ||||
| Reporter | patchman | View Status | public | ||||||
| Assigned To | uClibc | ||||||||
| Priority | normal | Resolution | fixed | ||||||
| Status | closed | Product Version | 0.9.28.1 | ||||||
| Summary | 0001577: strtol accepts backtick as valid digit | ||||||||
| Description |
strtol will not report an error if a backtick is part of the number-string to convert. E.g. "5000`" will be converted to 50009. Looking at the code I see that this is a corner case that is not checked: ... digit = (((Wuchar)(*str - '0')) <= 9) ? (*str - '0') : ((*str >= 'A') ? (((0x20|(*str)) - 'a' + 10)) /* WARNING: assumes ascii. */ : 40); if (digit >= base) { break; } ... A backtick is 0x60. So it is greater than 'A'. 0x20|0x60 is 0x80. 0x80-'a'+10 evaluates to '9' which is accepted as a valid digit. This piece of code occurs more than once in the code. The trunk seems to contain the bug, too. The solution would be to explicitly check for this case. |
||||||||
| Additional Information | |||||||||
| Attached Files |
|
||||||||
|
|
|||||||||
| Copyright © 2000 - 2006 Mantis Group |