pgpool2.git / summary / log / commit / refs
commit ac36eb6877b3757a4d65a381fac7765a87707483
Author: Toshihiro Kitagawa <kitagawa at sraoss.co.jp>
Date: Mon Aug 29 13:03:46 2011 +0000
Fix invalid memory write in add_regex_pattern().
pool_config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pool_config.c b/pool_config.c
index 86c8c7dde..4a13be640 100644
--- a/pool_config.c
+++ b/pool_config.c
@@ -1985,7 +1985,7 @@ int add_regex_pattern(char *type, char *s)
currItem.flag = regex_flags;
/* Fill pattern array */
- currItem.pattern = malloc(sizeof(char)*(strlen(s)+1));
+ currItem.pattern = malloc(sizeof(char)*(strlen(s)+3)); /* '\0'+'^'+'$' */
if (currItem.pattern == NULL)
{
pool_error("add_to_patterns: unable to allocate new pattern");
[parent: 592b2706fb82]