[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37601 - libmicrohttpd/src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37601 - libmicrohttpd/src/microhttpd |
Date: |
Thu, 28 Jul 2016 17:15:47 +0200 |
Author: Karlson2k
Date: 2016-07-28 17:15:47 +0200 (Thu, 28 Jul 2016)
New Revision: 37601
Modified:
libmicrohttpd/src/microhttpd/internal.c
Log:
MHD_http_unescape(): replace call of strtoul() with MHD_strx_to_uint32_n_()
Modified: libmicrohttpd/src/microhttpd/internal.c
===================================================================
--- libmicrohttpd/src/microhttpd/internal.c 2016-07-28 13:18:20 UTC (rev
37600)
+++ libmicrohttpd/src/microhttpd/internal.c 2016-07-28 15:15:47 UTC (rev
37601)
@@ -25,6 +25,7 @@
*/
#include "internal.h"
+#include "mhd_str.h"
#ifdef HAVE_MESSAGES
#if DEBUG_STATES
@@ -134,25 +135,15 @@
char *rpos = val;
char *wpos = val;
char *end;
- unsigned int num;
char buf3[3];
while ('\0' != *rpos)
{
+ uint32_t num;
switch (*rpos)
{
case '%':
- if ( ('\0' == rpos[1]) ||
- ('\0' == rpos[2]) )
- {
- *wpos = '\0';
- return wpos - val;
- }
- buf3[0] = rpos[1];
- buf3[1] = rpos[2];
- buf3[2] = '\0';
- num = strtoul (buf3, &end, 16);
- if ('\0' == *end)
+ if (2 == MHD_strx_to_uint32_n_ (rpos + 1, 2, &num))
{
*wpos = (char)((unsigned char) num);
wpos++;
@@ -159,6 +150,7 @@
rpos += 3;
break;
}
+ /* TODO: add bad sequence handling */
/* intentional fall through! */
default:
*wpos = *rpos;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37601 - libmicrohttpd/src/microhttpd,
gnunet <=