Changeset: ba6ec088e2ae for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba6ec088e2ae
Modified Files:
        clients/mapilib/mapi.c
Branch: Oct2014
Log Message:

Don't use strdup on a string that may not be NULL-terminated.


diffs (16 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -4279,7 +4279,11 @@ mapi_query_part(MapiHdl hdl, const char 
        mid->active = hdl;
        /* remember the query just for the error messages */
        if (hdl->query == NULL) {
-               hdl->query = strdup(query);
+               hdl->query = malloc(size + 1);
+               if (hdl->query) {
+                       strncpy(hdl->query, query, size);
+                       hdl->query[size] = 0;
+               }
        } else {
                size_t sz = strlen(hdl->query);
                char *q;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to