Changed sscanf in urldecode to use more portable scan-spec.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 7 Jul 2008 07:25:28 +0000 (09:25 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 7 Jul 2008 07:25:28 +0000 (09:25 +0200)
Changed sscanf in urldecode to use more portable scan spec. This fixes
the %XX decoding on Windows.

src/http.c

index 642465f..ec72838 100644 (file)
@@ -230,12 +230,13 @@ static void urldecode(char *i, char *o)
             *(o++) = ' ';
             i++;
         }
-        else if (*i == '%')
+        else if (*i == '%' && i[1] && i[2])
         {
+            int v;
             i++;
-            sscanf(i, "%2hhx", o);
+            sscanf(i, "%2x", &v);
+            *o++ = v;
             i += 2;
-            o++;
         }
         else
             *(o++) = *(i++);