Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Fix unportable usage of <ctype.h> functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Nov 2017 18:49:36 +0000 (13:49 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 7 Nov 2017 18:50:03 +0000 (13:50 -0500)
isdigit(), isspace(), etc are likely to give surprising results if passed a
signed char.  We should always cast the argument to unsigned char to avoid
that.  Error in commit 63d6b97fd, found by buildfarm member gaur.
Back-patch to 9.3, like that commit.

src/interfaces/ecpg/ecpglib/data.c

index 60c94c8d582bdeedce523ae9afd1dcb934218608..230d7c6bcb8a8428cab28e45f4e096bb95d6c306 100644 (file)
@@ -59,7 +59,7 @@ garbage_left(enum ARRAY_TYPE isarray, char **scan_length, enum COMPAT_MODE compa
            /* skip invalid characters */
            do {
                (*scan_length)++;
-           } while (isdigit(**scan_length));
+           } while (isdigit((unsigned char) **scan_length));
        }
 
        if (**scan_length != ' ' && **scan_length != '\0')