mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	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.
This commit is contained in:
		
							parent
							
								
									d3917186b2
								
							
						
					
					
						commit
						e66fcce672
					
				| @ -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; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user