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

SourceForge.net noreply at sourceforge.net
Thu Jun 12 10:02:40 EDT 2003


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

Category: odbc
Group: None
>Status: Closed
>Resolution: Fixed
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.



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

>Comment By: Frediano Ziglio (freddy77)
Date: 2003-06-12 16:02

Message:
Logged In: YES 
user_id=75766

Applyed

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

Comment By: Gerhard Esterhuizen (gmpff)
Date: 2003-06-12 15:55

Message:
Logged In: YES 
user_id=698709

I forgot to check the file attach box. Please forgive me for
being an idiot. Here it is attached now.


    g.


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

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