Thread: postgreSQL 6.4 patches.

postgreSQL 6.4 patches.

From
"Billy G. Allie"
Date:
The pg_atoi() function uses strtol() to convert the string to numbers.  Some
implementations of strtol() treat empty strings ("") as invalid arguments
while others convert this (erroneously, IHMO) to zero (0).  Assuming that the
expected behaviour of pg_atoi() is to return 0 if it is passed an empty
string, I am supplying the following patch to explictly check for an empty
string in pg_atoi() and return 0 if the string is empty.  The patch will also
trap a NULL character pointer being passed to pg_atoi() and will use elog() to
print out an error message if the input char pointer is NULL.

____       | Billy G. Allie    | Domain....: Bill.Allie@mug.org
|  /|      | 7436 Hartwell     | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
|/  |LLIE  | (313) 582-1540    |

Attachment

Re: [HACKERS] postgreSQL 6.4 patches.

From
Bruce Momjian
Date:
Applied.

> The pg_atoi() function uses strtol() to convert the string to numbers.  Some
> implementations of strtol() treat empty strings ("") as invalid arguments
> while others convert this (erroneously, IHMO) to zero (0).  Assuming that the
> expected behaviour of pg_atoi() is to return 0 if it is passed an empty
> string, I am supplying the following patch to explictly check for an empty
> string in pg_atoi() and return 0 if the string is empty.  The patch will also
> trap a NULL character pointer being passed to pg_atoi() and will use elog() to
> print out an error message if the input char pointer is NULL.
>
Content-Description: uw7p4.patch

[Attachment, skipping...]

> ____       | Billy G. Allie    | Domain....: Bill.Allie@mug.org
> |  /|      | 7436 Hartwell     | Compuserve: 76337,2061
> |-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
> |/  |LLIE  | (313) 582-1540    |


--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)