HTTP: fix stack overwrite due to format string error.
[silc.git] / lib / silchttp / silchttpserver.c
index 772d9c9b2b5e742a4d88bf8e3c54eb7c76a7a517..e83d2f379b274f1106774bbc754ecb98ecf8482d 100644 (file)
@@ -146,7 +146,7 @@ static SilcBool silc_http_server_parse(SilcHttpServer httpd,
     SILC_LOG_DEBUG(("URI: '%s'", conn->uri));
 
     /* Protocol version compatibility */
-    tmp = memchr(tmp, '\0', data_len - (tmp - data)) + 1;
+    tmp = ((unsigned char *)memchr(tmp, '\0', data_len - (tmp - data))) + 1;
     SILC_LOG_DEBUG(("Protocol: %s", tmp));
     if (strstr(tmp, "HTTP/1.0"))
       conn->keepalive = FALSE;
@@ -194,7 +194,7 @@ static SilcBool silc_http_server_parse(SilcHttpServer httpd,
 
     /* Check we have received all data */
     cl = silc_mime_get_field(conn->curheaders, "Content-Length");
-    if (cl && sscanf(cl, "%lu", (unsigned long *)&cll) == 1) {
+    if (cl && sscanf(cl, "%u", &cll) == 1) {
       if (data_len < cll) {
        /* More data to come */
        silc_mime_free(conn->curheaders);