diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-02-19 11:38:47 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-02-19 11:38:47 +0900 |
commit | b5cb6022bbf0a748220a1086aa398214dfca7c6d (patch) | |
tree | 5e7c22b204bb5507dcaafe9062b8eeb897906d59 /src/interfaces/ecpg/compatlib/informix.c | |
parent | 1d577f2eaa88b1d4caab3e859a01d25ecd9f81c5 (diff) |
ecpg: Fix zero-termination of string generated by intoasc()
intoasc(), a wrapper for PGTYPESinterval_to_asc that converts an
interval to its textual representation, used a plain memcpy() when
copying its result. This could miss a zero-termination in the result
string, leading to an incorrect result.
The routines in informix.c do not provide the length of their result
buffer, which would allow a replacement of strcpy() to safer strlcpy()
calls, but this requires an ABI breakage and that cannot happen in
back-branches.
Author: Oleg Tselebrovskiy
Reviewed-by: Ashutosh Bapat
Discussion: https://postgr.es/m/bf47888585149f83b276861a1662f7e4@postgrespro.ru
Backpatch-through: 12
Diffstat (limited to 'src/interfaces/ecpg/compatlib/informix.c')
-rw-r--r-- | src/interfaces/ecpg/compatlib/informix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index dccf39582da..80d40aa3e09 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -654,7 +654,7 @@ intoasc(interval * i, char *str) if (!tmp) return -errno; - memcpy(str, tmp, strlen(tmp)); + strcpy(str, tmp); free(tmp); return 0; } |