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 /src/pl | |
| parent | 6d0efd3a092ec60c7e27b53e604cbc87ba3c8e2c (diff) | |
| download | postgresql-beca984e5f1c315d02064e69861be112f5a69b3d.tar.gz | |
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 'src/pl')
| -rw-r--r-- | src/pl/plpgsql/src/pl_exec.c | 5 | ||||
| -rw-r--r-- | src/pl/plpgsql/src/pl_funcs.c | 8 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 7b350caf15..c5e036ccb7 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.178 2006/09/06 20:40:48 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.179 2006/09/22 21:39:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -26,6 +26,7 @@ #include "funcapi.h" #include "optimizer/clauses.h" #include "parser/parse_expr.h" +#include "parser/scansup.h" #include "tcop/tcopprot.h" #include "utils/array.h" #include "utils/builtins.h" @@ -2527,7 +2528,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate, char *ptr; for (ptr = querystr; *ptr; ptr++) - if (!isspace((unsigned char) *ptr)) + if (!scanner_isspace(*ptr)) break; if (*ptr == 'S' || *ptr == 's') ereport(ERROR, diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index f763e25e8d..566480485b 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.54 2006/08/14 21:14:41 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.55 2006/09/22 21:39:58 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -381,7 +381,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents) /* Normal identifier: extends till dot or whitespace */ const char *thisstart = s; - while (*s && *s != '.' && !isspace((unsigned char) *s)) + while (*s && *s != '.' && !scanner_isspace(*s)) s++; /* Downcase and truncate to NAMEDATALEN */ curident = downcase_truncate_identifier(thisstart, s - thisstart, @@ -400,11 +400,11 @@ plpgsql_convert_ident(const char *s, char **output, int numidents) /* If not done, skip whitespace, dot, whitespace */ if (*s) { - while (*s && isspace((unsigned char) *s)) + while (*s && scanner_isspace(*s)) s++; if (*s++ != '.') elog(ERROR, "expected dot between identifiers: %s", sstart); - while (*s && isspace((unsigned char) *s)) + while (*s && scanner_isspace(*s)) s++; if (*s == '\0') elog(ERROR, "expected another identifier: %s", sstart); |
