git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 94ae6ba)
isdigit() needs an unsigned char argument.
Thu, 6 Mar 2014 19:19:00 +0000 (21:19 +0200)
Thu, 6 Mar 2014 19:40:10 +0000 (21:40 +0200)
Per the C standard, the routine should be passed an int, with a value that's
representable as an unsigned char or EOF. Passing a signed char is wrong,
because a negative value is not representable as an unsigned char.
Unfortunately no compiler warns about that.


diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 8ba3209fda5491629f35ebb14deb80e3e9f1cbca..ce30bb6e9fa65e503beeea7ccd9cf82bf050bd09 100644 (file)
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -511,7 +511,7 @@ parse_sane_timezone(struct pg_tm *tm, text *zone)
* as invalid, it's enough to disallow having a digit in the first
* position of our input string.
*/
- if (isdigit(*tzname))
+ if (isdigit((unsigned char) *tzname))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid input syntax for numeric time zone: \"%s\"",
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /