Skip to content

Commit f93d612

Browse files
committed
OGRParseDate(): avoid tainted_data Coverity Scan warning in ogrpglayer.cpp:1380 (calling SetField() with value of PQgetvalue())
1 parent bdf9a44 commit f93d612

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ogr/ogrutils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ int OGRParseDate(const char *pszInput, OGRField *psField, int nOptions)
10831083
/* -------------------------------------------------------------------- */
10841084
/* Do we have a date? */
10851085
/* -------------------------------------------------------------------- */
1086-
while (*pszInput == ' ')
1086+
for (int i = 0; i < 256 && *pszInput == ' '; ++i)
10871087
++pszInput;
10881088

10891089
bool bGotSomething = false;
@@ -1115,7 +1115,7 @@ int OGRParseDate(const char *pszInput, OGRField *psField, int nOptions)
11151115

11161116
if (*pszInput == '-')
11171117
++pszInput;
1118-
while (*pszInput >= '0' && *pszInput <= '9')
1118+
for (int i = 0; i < 5 && *pszInput >= '0' && *pszInput <= '9'; ++i)
11191119
++pszInput;
11201120
if (*pszInput != '-' && *pszInput != '/')
11211121
return FALSE;
@@ -1189,7 +1189,7 @@ int OGRParseDate(const char *pszInput, OGRField *psField, int nOptions)
11891189
/* -------------------------------------------------------------------- */
11901190
/* Do we have a time? */
11911191
/* -------------------------------------------------------------------- */
1192-
while (*pszInput == ' ')
1192+
for (int i = 0; i < 256 && *pszInput == ' '; ++i)
11931193
++pszInput;
11941194
if (*pszInput == 'T')
11951195
{

0 commit comments

Comments
 (0)