diff options
author | Neil Conway <neilc@samurai.com> | 2004-02-04 01:11:47 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-02-04 01:11:47 +0000 |
commit | e66fcce67272f5aece55e834b34ed318b67f921b (patch) | |
tree | 911e8697bcdb32e806ec1d96d6b7b6a714bd69c4 /src/backend/utils/adt/numeric.c | |
parent | d3917186b26bb95641b6c6189c5c23989c41f69d (diff) | |
download | postgresql-e66fcce67272f5aece55e834b34ed318b67f921b.tar.gz postgresql-e66fcce67272f5aece55e834b34ed318b67f921b.zip |
Use memmove() rather than memcpy() in set_var_from_var(). If this function
is asked to assign a variable to itself, it will result in doing a
memcpy() on an entirely-overlapping memory range, which results in
undefined behavior according to ANSI C. That said, it is unlikely to
actually do anything bad on any sane libc, but this keeps valgrind quiet.
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
-rw-r--r-- | src/backend/utils/adt/numeric.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index e825b101a16..f093c414ee5 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -14,7 +14,7 @@ * Copyright (c) 1998-2003, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.70 2003/12/02 00:26:59 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.71 2004/02/04 01:11:47 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -2729,7 +2729,7 @@ set_var_from_var(NumericVar *value, NumericVar *dest) digitbuf_free(dest->buf); - memcpy(dest, value, sizeof(NumericVar)); + memmove(dest, value, sizeof(NumericVar)); dest->buf = newbuf; dest->digits = newbuf + 1; } |