bug-glpk
[Top][All Lists]
Advanced

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

[Bug-glpk] Memory access error in glpsql.c


From: Xypron
Subject: [Bug-glpk] Memory access error in glpsql.c
Date: Thu, 30 Jun 2011 23:19:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110620 Thunderbird/5.0b2

Hello Andrew, hello Alex,

in glpk-4.45/src/glpsql.c a memory access error may occur for multiple line SQL statements.

Please, apply the patch below. I have uploaded patched Windows executables and sources at
http://sourceforge.net/projects/winglpk/files/winglpk/GLPK-4.45.2/

I also applied the patch described in
http://lists.gnu.org/archive/html/help-glpk/2011-02/msg00049.html

I will go on analyzing the bkf file Alex sent.

Best regards

Xypron

--- glpk-4.45/src/glpsql.c      2010-12-05 10:00:00.000000000 +0100
+++ glpk-4.45/src/glpsql.c      2011-06-30 07:19:49.000000000 +0200
@@ -116,10 +116,13 @@
    {
       arg = mpl_tab_get_arg(dca, j);
       len = strlen(arg);
+      /* add length of part */
       lentot += len;
+ /* add length of space separating parts or 0x00 at end of SQL statement */
+      lentot++;
       if (arg[len-1] == ';' || j == narg)
       {  /* Join arguments for a single SQL statement */
-         sqllines[i] = xmalloc(lentot+1);
+         sqllines[i] = xmalloc(lentot);
          sqllines[i+1] = NULL;
          sqllines[i][0] = 0x00;
          for (j1 = j0; j1 <= j; j1++)






reply via email to

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