-rw-r--r-- | lib/util.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/util.cc b/lib/util.cc index 4028697..02f9473 100644 --- a/lib/util.cc +++ b/lib/util.cc | |||
@@ -214,17 +214,16 @@ namespace opkele { | |||
214 | for(string::const_iterator i=str.begin(),ie=str.end(); | 214 | for(string::const_iterator i=str.begin(),ie=str.end(); |
215 | i!=ie;++i) { | 215 | i!=ie;++i) { |
216 | switch(*i) { | 216 | switch(*i) { |
217 | case '+': | 217 | case '+': |
218 | *(ii++) = ' '; break; | 218 | *(ii++) = ' '; break; |
219 | case '%': | 219 | case '%': |
220 | ++i; | 220 | if((++i)==ie) |
221 | if(i==ie) | ||
222 | throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string"); | 221 | throw failed_conversion(OPKELE_CP_ "trailing percent in the url-encoded string"); |
223 | tmp[0] = *(i++); | 222 | tmp[0] = *i; |
224 | if(i==ie) | 223 | if((++i)==ie) |
225 | throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string"); | 224 | throw failed_conversion(OPKELE_CP_ "not enough hexadecimals after the percent sign in url-encoded string"); |
226 | tmp[1] = *i; | 225 | tmp[1] = *i; |
227 | if(!(isxdigit(tmp[0]) && isxdigit(tmp[1]))) | 226 | if(!(isxdigit(tmp[0]) && isxdigit(tmp[1]))) |
228 | throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string"); | 227 | throw failed_conversion(OPKELE_CP_ "non-hex follows percent in url-encoded string"); |
229 | *(ii++) = (char)strtol(tmp,0,16); | 228 | *(ii++) = (char)strtol(tmp,0,16); |
230 | break; | 229 | break; |