Skip to content

Commit

Permalink
Change CPLvsprintf to CPLvsnprintf (OSGeo#5787)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/gdal/trunk@28204 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
schwehr committed Dec 24, 2014
1 parent 8dc90fd commit 155a4c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gdal/port/cpl_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ void CPLErrorV(CPLErr eErrClass, int err_no, const char *fmt, va_list args )
va_end( wrk_args );
}
#else
CPLvsprintf( psCtx->szLastErrMsg, fmt, args);
// !HAVE_VSNPRINTF
CPLvsnprintf( psCtx->szLastErrMsg, psCtx->nLastErrMsgMax, fmt, args);
#endif

/* -------------------------------------------------------------------- */
Expand Down
4 changes: 2 additions & 2 deletions gdal/port/cplstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ CPLString &CPLString::vPrintf( const char *pszFormat, va_list args )

#if !defined(HAVE_VSNPRINTF)
char *pszBuffer = (char *) CPLMalloc(30000);
if( CPLvsprintf( pszBuffer, pszFormat, args) > 29998 )
if( CPLvsnprintf( pszBuffer, 30000, pszFormat, args) > 29998 )
{
CPLError( CE_Fatal, CPLE_AppDefined,
CPLError( CE_Fatal, CPLE_AppDefined,
"CPLString::vPrintf() ... buffer overrun." );
}
*this = pszBuffer;
Expand Down

0 comments on commit 155a4c0

Please sign in to comment.