From beca984e5f1c315d02064e69861be112f5a69b3d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 22 Sep 2006 21:39:58 +0000 Subject: 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 functions, that is, ye olde char-vs-unsigned-char issue. I won't miss when we are finally able to stop using it. --- contrib/pgcrypto/imath.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'contrib/pgcrypto') diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c index 17d90ed039..6375fd7a88 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; } -- cgit v1.2.1