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

Commit8fd2e26

Browse files
committed
MakeRetrieveViewRuleName was scribbling on memory that didn't belong
to it. Bad dog.
1 parenta8aa2f9 commit8fd2e26

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

‎src/backend/commands/view.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Id: view.c,v 1.51 2000/12/21 17:36:15 tgl Exp $
9+
*$Id: view.c,v 1.52 2001/01/03 18:43:09 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -110,19 +110,20 @@ char *
110110
MakeRetrieveViewRuleName(char*viewName)
111111
{
112112
char*buf;
113-
#ifdefMULTIBYTE
114-
intlen;
115-
#endif
116-
117-
buf=palloc(strlen(viewName)+5);
118-
snprintf(buf,strlen(viewName)+5,"_RET%s",viewName);
113+
intbuflen,
114+
maxlen;
119115

116+
buflen=strlen(viewName)+5;
117+
buf=palloc(buflen);
118+
snprintf(buf,buflen,"_RET%s",viewName);
119+
/* clip to less than NAMEDATALEN bytes, if necessary */
120120
#ifdefMULTIBYTE
121-
len=pg_mbcliplen(buf,strlen(buf),NAMEDATALEN-1);
122-
buf[len]='\0';
121+
maxlen=pg_mbcliplen(buf,strlen(buf),NAMEDATALEN-1);
123122
#else
124-
buf[NAMEDATALEN-1]='\0';
123+
maxlen=NAMEDATALEN-1;
125124
#endif
125+
if (maxlen<buflen)
126+
buf[maxlen]='\0';
126127

127128
returnbuf;
128129
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp