Bugs item #1229018, was opened at 2005-06-28 07:02
Message generated for change (Comment added) made by sf-robot
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1229018&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Mapi
Group: MonetDB4 CVS Head
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Steffen Goeldner (sgoeldner)
Assigned to: Steffen Goeldner (sgoeldner)
Summary: !unexpected end of input

Initial Comment:
Running

  use DBI();
  $dsn = 'dbi:ODBC:driver=MonetDB ODBC Driver';
  $dbh = DBI->connect( $dsn ) or die $DBI::errstr;
  $tbl = 'perl_dbd_test';
  $dbh->do("drop table $tbl");
  $dbh->do("create table $tbl( A int, B varchar(50), C 
varchar(300), D date )");
  $sth = $dbh->prepare("insert into $tbl (A, B, C, D) 
VALUES (?, ?, ?, ?)");
  $sth->bind_param( 1, 1 );
  $sth->bind_param( 2,'foo');
  $sth->bind_param( 3,'me' x 120 );
  $sth->bind_param( 4,'1998-05-13');
  $sth->execute;

shows

  DBD::ODBC::st execute failed: [MonetDB][ODBC 
Driver 1.0]!unexpected end of input (SQL-42000)

----------------------------------------------------------------------

>Comment By: SourceForge Robot (sf-robot)
Date: 2007-12-20 19:20

Message:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 365 days (the time period specified by
the administrator of this Tracker).

----------------------------------------------------------------------

Comment By: SourceForge Robot (sf-robot)
Date: 2006-12-19 19:20

Message:
Logged In: YES 
user_id=1312539
Originator: NO

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 365 days (the time period specified by
the administrator of this Tracker).

----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2006-01-15 06:39

Message:
Logged In: YES 
user_id=572415

right, all "pending" bugs still don't have a test script,
although one could create one --- usualy requires "more
effort" and/or new functionallity in Mtest.py and/or
detailed checks whether to add a test script at all...


----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2006-01-15 06:14

Message:
Logged In: YES 
user_id=963970

is this bug pending because there is no test available?

----------------------------------------------------------------------

Comment By: Stefan Manegold (stmane)
Date: 2005-12-19 09:12

Message:
Logged In: YES 
user_id=572415

see also
https://sourceforge.net/tracker/index.php?func=detail&aid=1225455&group_id=56967&atid=482468

----------------------------------------------------------------------

Comment By: Ying Zhang (yingying)
Date: 2005-12-19 07:51

Message:
Logged In: YES 
user_id=341633

BugDag_2005-12-19, Jennie: REASSIGN to Steffen or Sjoerd.

Don't know how to make test script for Perl, sorry!

----------------------------------------------------------------------

Comment By: Steffen Goeldner (sgoeldner)
Date: 2005-07-01 05:36

Message:
Logged In: YES 
user_id=1174087

O.k., fixed:

  
<http://cvs.sourceforge.net/viewcvs.py/monetdb/MonetDB/src/
mapi/clients/C/Mapi.mx?r1=1.156.2.7&r2=1.156.2.8>


----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2005-06-30 08:22

Message:
Logged In: YES 
user_id=43607

Looks good.  Can you check this in in the stable branch?

----------------------------------------------------------------------

Comment By: Steffen Goeldner (sgoeldner)
Date: 2005-06-30 07:22

Message:
Logged In: YES 
user_id=1174087

I added traces on the client-side (src/mapi/clients/C/Mapi.c):

  @@ -1800,7 +1800,9 @@
                  p = q + 1;
                  q = strchr(p, PLACEHOLDER);
          }
  +       printf("***: =%d %d ... %s\n", lim, strlen(hdl->query), 
hdl->query + k - 10);
          checkSpace(strlen(p));
  +       printf("***: =%d %d ... %s\n", lim, strlen(hdl->query), 
hdl->query + k - 10);
          strcpy(hdl->query + k, p);
          if (hdl->mid->trace)
                  printf("param_store: result=%s\n", hdl->query);

The output is:

  ***: =314 315 ... 998-05-13'
  ***: =572 314 ... 998-05-13

I.e., lim < strlen(hdl->query), which means a buffer overrun.
Trying to make room for \' and \0 seems to work:

  @@ -1779,13 +1779,13 @@
                                  buf[0] = *(char *) src;
                                  buf[1] = 0;
                                  val = mapi_quote(buf, 1);
  -                               checkSpace(strlen(val));
  +                               checkSpace(strlen(val)+3);
                                  sprintf(hdl->query + k, "'%s'", val);
                                  free(val);
                                  break;
                          case MAPI_VARCHAR:
                                  val = mapi_quote((char *) src, hdl-
>params[i].sizeptr ? *hdl->params[i].sizeptr : -1);
  -                               checkSpace(strlen(val));
  +                               checkSpace(strlen(val)+3);
                                  sprintf(hdl->query + k, "'%s'", val);
                                  free(val);
                                  break;
  @@ -1800,7 +1800,7 @@
                  p = q + 1;
                  q = strchr(p, PLACEHOLDER);
          }
  -       checkSpace(strlen(p));
  +       checkSpace(strlen(p)+1);
          strcpy(hdl->query + k, p);
          if (hdl->mid->trace)
                  printf("param_store: result=%s\n", hdl->query);

O.k.?


----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2005-06-29 00:21

Message:
Logged In: YES 
user_id=963970

if you don't have strace available for your platform, I
think tools like ethereal are your only solution if you
don't want to hack sources.

----------------------------------------------------------------------

Comment By: Steffen Goeldner (sgoeldner)
Date: 2005-06-28 23:40

Message:
Logged In: YES 
user_id=1174087

Yes, it survives. Is it possible to trace the input it receives?

----------------------------------------------------------------------

Comment By: Fabian (mr-meltdown)
Date: 2005-06-28 12:05

Message:
Logged In: YES 
user_id=963970

does the server survive this?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1229018&group_id=56967

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to