Changeset: e70dd53b742e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e70dd53b742e
Modified Files:
        clients/mapiclient/dump.c
        monetdb5/mal/mal_profiler.c
        monetdb5/modules/atoms/mcurl.c
Branch: Jan2014
Log Message:

Coverity fixes.


diffs (63 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -1099,6 +1099,8 @@ dump_table_data(Mapi mid, char *schema, 
                goto bailout;
 
        cnt = mapi_get_field_count(hdl);
+       if (cnt < 1 || cnt >= 1 << 29)
+               goto bailout;   /* ridiculous number of columns */
        string = malloc(sizeof(int) * cnt);
        for (i = 0; i < cnt; i++) {
                string[i] = 0;
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -1349,8 +1349,11 @@ static int getCPULoad(char cpuload[BUFSI
                        if ( *s == ' ') {
                                s++;
                                cpu = 255; // the cpu totals stored here
-                       }  else 
+                       }  else {
                                cpu = atoi(s);
+                               if (cpu < 0 || cpu > 255)
+                                       cpu = 255;
+                       }
                        s= strchr(s,' ');
                        if ( s== 0 || cpu < 0 || cpu > 255) goto skip;
                        
diff --git a/monetdb5/modules/atoms/mcurl.c b/monetdb5/modules/atoms/mcurl.c
--- a/monetdb5/modules/atoms/mcurl.c
+++ b/monetdb5/modules/atoms/mcurl.c
@@ -90,6 +90,7 @@ handle_get_request(str *retval, str *url
        curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, 
WriteMemoryCallback);
 
        /* we want the body be written to this file handle instead of stdout */
+       /* coverity[bad_sizeof] */
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
 
        /* get it! */
@@ -155,6 +156,7 @@ handle_put_request(str *retval, str *url
        curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, 
WriteMemoryCallback);
 
        /* we want the body be written to this file handle instead of stdout */
+       /* coverity[bad_sizeof] */
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
 
        /* get it! */
@@ -220,6 +222,7 @@ handle_post_request(str *retval, str *ur
        curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, 
WriteMemoryCallback);
 
        /* we want the body be written to this file handle instead of stdout */
+       /* coverity[bad_sizeof] */
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
 
        /* get it! */
@@ -286,6 +289,7 @@ handle_delete_request(str *retval, str *
        curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, 
WriteMemoryCallback);
 
        /* we want the body be written to this file handle instead of stdout */
+       /* coverity[bad_sizeof] */
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk);
 
        /* get it! */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to