From: Mark Cave-Ayland Date: Wed, 15 Oct 2008 21:44:19 +0000 (+0000) Subject: Fix pointer problem in the new HINT code caused by strncpy() not padding with zeros... X-Git-Tag: 1.4.0b1~616 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a0dd7fd05dbd4cb01a40c6619dde0b79b66c9e4;p=postgis Fix pointer problem in the new HINT code caused by strncpy() not padding with zeros unless the specified length is *longer* than the source string. git-svn-id: http://svn.osgeo.org/postgis/trunk@3117 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/lwgeom/lwgeom_pg.c b/lwgeom/lwgeom_pg.c index 986f9b699..73deb426f 100644 --- a/lwgeom/lwgeom_pg.c +++ b/lwgeom/lwgeom_pg.c @@ -44,7 +44,7 @@ pg_parser_errhint(LWGEOM_PARSER_RESULT *lwg_parser_result) /* If we are not at the start of the buffer, prefix with "..." */ if (hintstart != lwg_parser_result->wkinput) - strncpy(hintbuffer, "...", 3); + strncpy(hintbuffer, "...", 4); /* Append to the existing string */ strncat(hintbuffer, hintstart, hintfinish-hintstart);