Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec54a6e

Browse files
committed
Fix buffer overrun in to_ascii(), per report from Guido Notari.
1 parent794162b commitec54a6e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

‎src/backend/utils/adt/ascii.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* ascii.c
33
*
4-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ascii.c,v 1.13 2002/08/2907:22:26 ishii Exp $
4+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ascii.c,v 1.14 2003/04/02 21:07:59 tgl Exp $
55
*
66
* Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
77
*
@@ -27,9 +27,9 @@ static text *encode_to_ascii(text *data, int enc);
2727
char*
2828
pg_to_ascii(unsignedchar*src,unsignedchar*src_end,unsignedchar*desc,intenc)
2929
{
30-
unsignedchar*x=NULL;
31-
unsignedchar*ascii=NULL;
32-
intrange=0;
30+
unsignedchar*x;
31+
unsignedchar*ascii;
32+
intrange;
3333

3434
/*
3535
* relevant start for an encoding
@@ -66,12 +66,13 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *desc, int
6666
{
6767
elog(ERROR,"pg_to_ascii(): unsupported encoding from %s",
6868
pg_encoding_to_char(enc));
69+
returnNULL;/* keep compiler quiet */
6970
}
7071

7172
/*
7273
* Encode
7374
*/
74-
for (x=src;x <=src_end;x++)
75+
for (x=src;x<src_end;x++)
7576
{
7677
if (*x<128)
7778
*desc++=*x;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp