diff options
Diffstat (limited to 'cpp/src/qpid/Url.cpp')
| -rw-r--r-- | cpp/src/qpid/Url.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cpp/src/qpid/Url.cpp b/cpp/src/qpid/Url.cpp index b7d6f76a94..f831167dd8 100644 --- a/cpp/src/qpid/Url.cpp +++ b/cpp/src/qpid/Url.cpp @@ -125,7 +125,7 @@ class UrlParser { bool pctEncoded() { return literal("%") && hexDigit() && hexDigit(); } - bool hexDigit() { return ::strchr("01234567890abcdefABCDEF", *i) && advance(); } + bool hexDigit() { return i < end && ::strchr("01234567890abcdefABCDEF", *i) && advance(); } bool port(uint16_t& p) { return decimalInt(p); } @@ -133,13 +133,16 @@ class UrlParser { template <class IntType> bool decimalInt(IntType& n) { const char* start = i; - while (::isdigit(*i)) ++i; + while (decDigit()) + ; try { n = lexical_cast<IntType>(string(start, i)); return true; } catch(...) { return false; } } + bool decDigit() { return i < end && ::isdigit(*i) && advance(); } + bool literal(const char* s) { int n = ::strlen(s); if (n <= end-i && equal(s, s+n, i)) return advance(n); |
