Unix Technical Forum

ecpg: fix ECPGstore_input()

This is a discussion on ecpg: fix ECPGstore_input() within the Pgsql Patches forums, part of the PostgreSQL category; --> This patch fixes the following issues in ECPGstore_input(): - strlen() was invoked on the NULL pointer for the first ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 11:38 PM
Neil Conway
 
Posts: n/a
Default ecpg: fix ECPGstore_input()

This patch fixes the following issues in ECPGstore_input():

- strlen() was invoked on the NULL pointer for the first iteration of
the loop (line 875, 923, 966, 1009)

- `nval' is freed for every iteration of the loop at 864, but only
initialized once outside the loop, resulting in potential multiple
free()'s, as well as the use of a freed variable in subsequent iterations

- `str' was leaked for every subsequent iteration of the loop (line 871,
920, 963, 1006)

- the return value of PGTYPESinterval_to_asc() is leaked at line 920 and
937; the return value of PGTYPESdate_to_asc() is leaked at line 963 and
980; the return value of PGTYPEStimestamp_to_asc() is leaked at line
1006 and 1023.

- malloc failure is in general not handled well; the function simply
returns without bothering to clean up allocated resources, and many
return values are not checked for errors.

Also, in create_statement(), `*stmt' was dereferenced before being
initialized.

Per the Coverity report run by EnterpriseDB. Thanks to Eric Astor at EDB
for an initial version of this patch -- the attached version has been
improved by myself.

Barring any objections, I'd like to apply this to CVS in a day or two (I
want to test it first, which I haven't yet done).

-Neil


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:13 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com