Changeset: 4b3e30f2208b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4b3e30f2208b
Modified Files:
clients/src/mapilib/Mapi.mx
Branch: Oct2010
Log Message:
mapi_query_part: fix crash when extending query buffer on Darwin
mclient(91320) malloc: *** error for object 0x401cc0: incorrect checksum
for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
The realloc fails because the initial strncpy aparently went in the
wrong place. Looks like similar buggyness as encountered before. Zero
the malloced string, such that copying into it goes from the start.
diffs (14 lines):
diff -r acf971c5233e -r 4b3e30f2208b clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx Tue Dec 21 13:16:04 2010 +0100
+++ b/clients/src/mapilib/Mapi.mx Thu Dec 23 21:32:34 2010 +0100
@@ -4394,8 +4394,9 @@
if (sz > 512)
sz = 512;
hdl->query = malloc(sz + 1);
+ hdl->query[0] = '\0';
strncpy(hdl->query, query, sz);
- hdl->query[sz] = 0;
+ hdl->query[sz] = '\0';
} else {
size_t sz = 512 - strlen(hdl->query);
if (sz > 0) {
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list