pg_* tests

From: Date: Tue, 12 Oct 1999 23:30:36 +0000
Subject: pg_* tests
Groups: php.version4 
Request: Send a blank email to php-version4+get-5528@lists.php.net to get a copy of this message
More pg_* tests , CVS update @ "Oct 13 01:03 php4" ph_host() evilness :) #0 0x80965fc in php3_pgsql_get_link_info (ht=-1073743092, return_value=0xbffffb0c, list=0x2d, plist=0x40014000, this_ptr=0x4012da38, entry_type=1073820520) at pgsql.c:470 470 return_value->value.str.len = strlen(return_value->value.str.val); (gdb) list 465 return_value->value.str.val = PQhost(pgsql); 466 break; 467 default: 468 RETURN_FALSE; 469 } 470 return_value->value.str.len = strlen(return_value->value.str.val); 471 return_value->value.str.val = (char *) estrdup(return_value->value.str.val); 472 return_value->type = IS_STRING; 473 } 474 Because PQhost() *can* also return null (weird(?)) I think there must be a check before that strlen there. Also I dunno if estrdup() is NULL safe (does it return a \0 string?) + check out this tiny little script: <? $db = pg_connect("dbname=tester user=tester password=tester") || die("pg_connect failure"); ($res = pg_exec($db,"SELECT * FROM foo")) || die(pg_errorMessage($db)); echo pg_fetch_object($res,0,'bogus'); ?> with a bogus return type I got: Object pgsql.c(923) : Freeing 0x08110F18 (6 bytes), script=pg_test6.php Last leak repeated 1 time Because I could fix the first one "by hand" I didn't submit a bug report, but hope the maintainer or someone w/ CVS account to fix it. cheers, -- CIMPOESU Teodor, Web Programmer (h) @ DIGICOM S.A. Bucharest, Romania @ Internet, site development @ teo@digiro.net, +(401)-330.47.28 official home page ~ http://www.digiro.net/ Internet web page ~ http://internet.digiro.net/

« previous php.version4 (#5528) next »