]> granicus.if.org Git - postgresql/commitdiff
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:49:50 +0000 (13:49 -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 090d60277f3d35c1f2f0acd827ce27499b7bf8a7..5159c619bbefa6a9d5c9837f9588700b3822bf22 100644 (file)
@@ -57,7 +57,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')