Static analyzer bug fixes
[silc.git] / lib / silchttp / silchttpserver.c
index cd94c407f4f3d7f53dfd06961c2daf46eb8a1400..20b2c0416f527c1b5918479df1324625cb679ae4 100644 (file)
@@ -181,6 +181,9 @@ static SilcBool silc_http_server_parse(SilcHttpServer httpd,
   if (value && !strcasecmp(value, "close"))
     conn->keepalive = FALSE;
 
+  if (!conn->method)
+    return FALSE;
+
   /* Deliver request to caller */
   if (!strcasecmp(conn->method, "GET") || !strcasecmp(conn->method, "HEAD")) {
     httpd->callback(httpd, conn, conn->uri, conn->method,
@@ -194,7 +197,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);