mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Bug 1485340 - Avoid isdigit() and isxdigit() in URL parsing. r=valentin
MozReview-Commit-ID: 13DUMcZIE19 Differential Revision: https://phabricator.services.mozilla.com/D4308 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8330d51c91
commit
2be0158cae
@ -26,6 +26,7 @@
|
||||
#include "prprf.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "mozilla/net/MozURL_ffi.h"
|
||||
#include "mozilla/TextUtils.h"
|
||||
|
||||
//
|
||||
// setenv MOZ_LOG nsStandardURL:5
|
||||
@ -435,10 +436,10 @@ ParseIPv4Number(const nsACString& input, int32_t base, uint32_t& number, uint32_
|
||||
for (; current < end; ++current) {
|
||||
value *= base;
|
||||
char c = *current;
|
||||
MOZ_ASSERT((base == 10 && isdigit(c)) ||
|
||||
MOZ_ASSERT((base == 10 && IsAsciiDigit(c)) ||
|
||||
(base == 8 && c >= '0' && c <= '7') ||
|
||||
(base == 16 && isxdigit(c)));
|
||||
if (isdigit(c)) {
|
||||
(base == 16 && IsAsciiHexDigit(c)));
|
||||
if (IsAsciiDigit(c)) {
|
||||
value += c - '0';
|
||||
} else if (c >= 'a' && c <= 'f') {
|
||||
value += c - 'a' + 10;
|
||||
|
Loading…
Reference in New Issue
Block a user