gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13040 - in libmicrohttpd/src/testcurl: . https


From: gnunet
Subject: [GNUnet-SVN] r13040 - in libmicrohttpd/src/testcurl: . https
Date: Tue, 21 Sep 2010 12:46:06 +0200

Author: grothoff
Date: 2010-09-21 12:46:06 +0200 (Tue, 21 Sep 2010)
New Revision: 13040

Modified:
   libmicrohttpd/src/testcurl/daemontest_get_chunked.c
   libmicrohttpd/src/testcurl/daemontest_large_put.c
   libmicrohttpd/src/testcurl/daemontest_long_header.c
   libmicrohttpd/src/testcurl/https/tls_extension_test.c
   libmicrohttpd/src/testcurl/https/tls_test_common.c
Log:
check malloc return values

Modified: libmicrohttpd/src/testcurl/daemontest_get_chunked.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_get_chunked.c 2010-09-21 10:30:10 UTC 
(rev 13039)
+++ libmicrohttpd/src/testcurl/daemontest_get_chunked.c 2010-09-21 10:46:06 UTC 
(rev 13040)
@@ -111,6 +111,8 @@
       return MHD_YES;
     }
   responseptr = malloc (sizeof (struct MHD_Response *));
+  if (responseptr == NULL)
+    return MHD_NO;
   response = MHD_create_response_from_callback (-1,
                                                 1024,
                                                 &crc, responseptr, &crcf);

Modified: libmicrohttpd/src/testcurl/daemontest_large_put.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_large_put.c   2010-09-21 10:30:10 UTC 
(rev 13039)
+++ libmicrohttpd/src/testcurl/daemontest_large_put.c   2010-09-21 10:46:06 UTC 
(rev 13040)
@@ -456,6 +456,7 @@
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
   put_buffer = malloc (PUT_SIZE);
+  if (NULL == put_buffer) return 1;
   memset (put_buffer, 1, PUT_SIZE);
   errorCount += testInternalPut ();
   errorCount += testMultithreadedPut ();

Modified: libmicrohttpd/src/testcurl/daemontest_long_header.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_long_header.c 2010-09-21 10:30:10 UTC 
(rev 13039)
+++ libmicrohttpd/src/testcurl/daemontest_long_header.c 2010-09-21 10:46:06 UTC 
(rev 13040)
@@ -112,6 +112,11 @@
     return 1;
   c = curl_easy_init ();
   url = malloc (VERY_LONG);
+  if (url == NULL)
+    {
+       MHD_stop_daemon (d);
+       return 1;
+    }
   memset (url, 'a', VERY_LONG);
   url[VERY_LONG - 1] = '\0';
   memcpy (url, "http://localhost:1080/";, strlen ("http://localhost:1080/";));
@@ -178,6 +183,11 @@
     return 16;
   c = curl_easy_init ();
   url = malloc (VERY_LONG);
+  if (url == NULL)
+     {
+       MHD_stop_daemon (d);
+       return 16;
+     }
   memset (url, 'a', VERY_LONG);
   url[VERY_LONG - 1] = '\0';
   url[VERY_LONG / 2] = ':';

Modified: libmicrohttpd/src/testcurl/https/tls_extension_test.c
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_extension_test.c       2010-09-21 
10:30:10 UTC (rev 13039)
+++ libmicrohttpd/src/testcurl/https/tls_extension_test.c       2010-09-21 
10:46:06 UTC (rev 13040)
@@ -93,7 +93,11 @@
   datalen = 2 /* version */ + TLS_RANDOM_SIZE + (session_id_len + 1);
 
   data = MHD_gnutls_malloc (datalen);
-
+  if (data == NULL)
+      {
+        free (cbc.buf);
+        return -1;
+      }
   hver = MHD_gtls_version_max (session);
   data[pos++] = MHD_gtls_version_get_major (hver);
   data[pos++] = MHD_gtls_version_get_minor (hver);

Modified: libmicrohttpd/src/testcurl/https/tls_test_common.c
===================================================================
--- libmicrohttpd/src/testcurl/https/tls_test_common.c  2010-09-21 10:30:10 UTC 
(rev 13039)
+++ libmicrohttpd/src/testcurl/https/tls_test_common.c  2010-09-21 10:46:06 UTC 
(rev 13040)
@@ -372,9 +372,18 @@
   gnutls_certificate_allocate_credentials (xcred);
   key->size = strlen (srv_key_pem);
   key->data = malloc (key->size);
+  if (key->data == NULL) 
+     {
+       return -1;
+     }
   memcpy (key->data, srv_key_pem, key->size);
   cert->size = strlen (srv_self_signed_cert_pem);
   cert->data = malloc (cert->size);
+  if (cert->data == NULL)
+    {
+       free (key->data); 
+       return -1;
+    }
   memcpy (cert->data, srv_self_signed_cert_pem, cert->size);
   gnutls_certificate_set_x509_key_mem (*xcred, cert, key,
                                       GNUTLS_X509_FMT_PEM);
@@ -382,7 +391,10 @@
   ret = gnutls_priority_set_direct (*session,
                                    "NORMAL", &err_pos);
   if (ret < 0)
-    return -1;
+    {
+       free (key->data);
+       return -1;
+    }
   gnutls_credentials_set (*session, 
                          GNUTLS_CRD_CERTIFICATE, 
                          xcred);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]