summaryrefslogtreecommitdiff
path: root/contrib/cube/cubeparse.y
diff options
context:
space:
mode:
authorBruce Momjian2002-08-29 23:03:58 +0000
committerBruce Momjian2002-08-29 23:03:58 +0000
commit32784cddf1da985b736d91402ad3eb22136751cc (patch)
tree41b9fcb5d30a89137ad0f811af0fb4599e8efb80 /contrib/cube/cubeparse.y
parent6d27cfdd894af3a428fd9a540dbac576978319f5 (diff)
The changes I have made are described in CHANGES. This was based on
diffs to 7.3-devel and may not be applicable to 7.2. I have included a change covered by a previous bugfix patch I submitted (the problem with -.1 not being accepted by cube_in). It does not include a fix for the potential buffer overrun issue I reported for cube_yyerror in cubeparse.y. Bruno Wolff III
Diffstat (limited to 'contrib/cube/cubeparse.y')
-rw-r--r--contrib/cube/cubeparse.y8
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/cube/cubeparse.y b/contrib/cube/cubeparse.y
index 33b7c1ef6b0..accad12511a 100644
--- a/contrib/cube/cubeparse.y
+++ b/contrib/cube/cubeparse.y
@@ -198,9 +198,10 @@ write_box(unsigned int dim, char *str1, char *str2)
NDBOX * bp;
char * s;
int i;
- int size = offsetof(NDBOX, x[0]) + sizeof(float) * dim * 2;
+ int size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
bp = palloc(size);
+ memset(bp, 0, size);
bp->size = size;
bp->dim = dim;
@@ -217,7 +218,7 @@ write_box(unsigned int dim, char *str1, char *str2)
s++; i++;
bp->x[i] = strtod(s, NULL);
}
-
+
return(bp);
}
@@ -230,9 +231,10 @@ static NDBOX * write_point_as_box(char *str)
int dim = delim_count(str, ',') + 1;
char * s = str;
- size = offsetof(NDBOX, x[0]) + sizeof(float) * dim * 2;
+ size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
bp = palloc(size);
+ memset(bp, 0, size);
bp->size = size;
bp->dim = dim;