From: Tatsuo Ishii Date: Wed, 21 Feb 2001 06:05:23 +0000 (+0000) Subject: Safe guard in case of imporper data is provided to elog() X-Git-Tag: REL7_1~330 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa877ed8eea131e3d24bf74294795ee319b93e06;p=postgresql Safe guard in case of imporper data is provided to elog() in multi-byte build. --- diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 2434f4d219..c19ad44d63 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.80 2001/01/24 19:43:15 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.81 2001/02/21 06:05:23 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -683,6 +683,8 @@ write_syslog(int level, const char *line) #ifdef MULTIBYTE /* trim to multibyte letter boundary */ buflen = pg_mbcliplen(buf, l, l); + if (buflen <= 0) + return; buf[buflen] = '\0'; l = strlen(buf); #endif