diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-22 21:39:58 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-22 21:39:58 +0000 |
commit | beca984e5f1c315d02064e69861be112f5a69b3d (patch) | |
tree | b06b0b54e649824380e3b35822c1c054dac24608 /contrib/pgcrypto/imath.c | |
parent | 6d0efd3a092ec60c7e27b53e604cbc87ba3c8e2c (diff) |
Fix bugs in plpgsql and ecpg caused by assuming that isspace() would only
return true for exactly the characters treated as whitespace by their flex
scanners. Per report from Victor Snezhko and subsequent investigation.
Also fix a passel of unsafe usages of <ctype.h> functions, that is, ye olde
char-vs-unsigned-char issue. I won't miss <ctype.h> when we are finally
able to stop using it.
Diffstat (limited to 'contrib/pgcrypto/imath.c')
-rw-r--r-- | contrib/pgcrypto/imath.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c index 17d90ed0398..6375fd7a889 100644 --- a/contrib/pgcrypto/imath.c +++ b/contrib/pgcrypto/imath.c @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.c,v 1.4 2006/07/19 17:05:50 neilc Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.c,v 1.5 2006/09/22 21:39:57 tgl Exp $ */ #include "postgres.h" #include "px.h" @@ -1799,7 +1799,7 @@ mp_result mp_int_read_cstring(mp_int z, mp_size radix, const char *str, char **e return MP_RANGE; /* Skip leading whitespace */ - while(isspace((int)*str)) + while(isspace((unsigned char) *str)) ++str; /* Handle leading sign tag (+/-, positive default) */ @@ -3127,10 +3127,10 @@ static int s_ch2val(char c, int r) { int out; - if(isdigit((int)c)) + if(isdigit((unsigned char)c)) out = c - '0'; - else if(r > 10 && isalpha((int)c)) - out = toupper(c) - 'A' + 10; + else if(r > 10 && isalpha((unsigned char) c)) + out = toupper((unsigned char) c) - 'A' + 10; else return -1; @@ -3151,7 +3151,7 @@ static char s_val2ch(int v, int caps) char out = (v - 10) + 'a'; if(caps) - return toupper(out); + return toupper((unsigned char) out); else return out; } |