[freetds] [ freetds-Patches-753288 ] Fix: int cast-and-deref in ODBC error.c.

SourceForge.net noreply at sourceforge.net
Thu Jun 12 09:50:24 EDT 2003


Patches item #753288, was opened at 2003-06-12 13:50
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=753288&group_id=33106

Category: odbc
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerhard Esterhuizen (gmpff)
Assigned to: Nobody/Anonymous (nobody)
Summary: Fix: int cast-and-deref in ODBC error.c.

Initial Comment:
In the nightly sources from 12/06/2003,
/src/odbc/error.c, line 404 we have:

*(SQLINTEGER *) buffer = *(SQLINTEGER *)
tsock->res_info->row_count;

This is a bug as tsock->res_info->row_count is a
TDS_INT containing the number of result rows and should
therefore not be cast to a pointer and dereferenced.
This causes segfaults when executing queries (using
SQLExecute) that returned  no results (resulting in a
NULL pointer being dereferenced).

I fixed this by changing the line to:

*(SQLINTEGER *) buffer = tsock->res_info->row_count;

A patch against nightly source 12062003 is attached.

Regards,
  
  gerhard.



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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=407808&aid=753288&group_id=33106



More information about the FreeTDS mailing list