Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24859

Modified Files:
      Tag: MonetDB_5-0
        language.mx 
Log Message:
make sure we don't crash in CMDevalFile, ie allocate a buffer if needed.


Index: language.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/language.mx,v
retrieving revision 1.60.2.2
retrieving revision 1.60.2.3
diff -u -d -r1.60.2.2 -r1.60.2.3
--- language.mx 12 Jun 2007 16:55:00 -0000      1.60.2.2
+++ language.mx 19 Aug 2007 09:53:13 -0000      1.60.2.3
@@ -295,23 +295,24 @@
 {
        str s = *fnme;
        Client c = MCgetClient();
-       char buffer[1024];
+       char *msg = NULL;
 
        (void) ret;             /* fool compiler */
-       if (s == 0) {
+       if (s == 0) 
                throw(MAL, "mal.setCwd", "File name missing\n");
-       }
-       if (strlen(s) + strlen(c->cwd) + 2 >= 1024) {
-               throw(MAL, "mal.setCwd", "Evaluation buffer too small\n");
-       }
-       buffer[0] = 0;
 
        if (*s != '/') {
-               strcpy(buffer, c->cwd);
-               strcat(buffer, "/");
+               char *buf = GDKmalloc(strlen(c->cwd) + strlen(s) + 2);
+
+               strcpy(buf, c->cwd);
+               strcat(buf, "/");
+               strcat(buf, s);
+               msg = evalFile(c, buf, 0);
+               GDKfree(buf);
+       } else {
+               msg = evalFile(c, s, 0);
        }
-       strcat(buffer, s);
-       return evalFile(c, buffer, 0);
+       return msg;
 }
 @-
 Calling a BAT is simply translated into a concatenation of


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to