Skip to content

Commit e66fcce

Browse files
author
Neil Conway
committed
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.
1 parent d391718 commit e66fcce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/numeric.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 1998-2003, PostgreSQL Global Development Group
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.70 2003/12/02 00:26:59 tgl Exp $
17+
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.71 2004/02/04 01:11:47 neilc Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -2729,7 +2729,7 @@ set_var_from_var(NumericVar *value, NumericVar *dest)
27292729

27302730
digitbuf_free(dest->buf);
27312731

2732-
memcpy(dest, value, sizeof(NumericVar));
2732+
memmove(dest, value, sizeof(NumericVar));
27332733
dest->buf = newbuf;
27342734
dest->digits = newbuf + 1;
27352735
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy