Skip to Content.
Sympa Menu

freetds - [freetds] Possible free(NULL) in tsql

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Possible free(NULL) in tsql
  • Date: Fri, 12 Oct 2007 10:56:50 +0200

Looking at recent changes at tsql.c
http://freetds.cvs.sourceforge.net/freetds/freetds/src/apps/tsql.c?r1=1.
107&r2=1.108&diff_format=l

if continue at line 711 is hit s2 == NULL and a free(s2) (line 690) is
executed. This can cause a core in some system. Perhaps we could undo
lines 717-718 removing free(s2) at line 690 or use a static buffer and
some code (strcpyn/strspn/other) to get cmd something like replacing
lines 717-723 with

cmd = s + strspn(s, " \t");
cmd_end = cmd + strcspn(cmd, " \t");
save = *cmd_end;
*cmd_end = 0;

and inserting a

*cmd_end = save;

before line 742

(char save; char *cmd_end;)

(I know, it's a fucking optimization!)

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page