aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/compatlib/informix.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-02-19 11:38:18 +0900
committerMichael Paquier <michael@paquier.xyz>2024-02-19 11:38:18 +0900
commite77a1c58e338a1aebf00e3ae82d282f8bd32fe17 (patch)
tree5d2d7e9d2a109a550871359da7de38964d92caad /src/interfaces/ecpg/compatlib/informix.c
parent0a9118ccc0eb2e6a31201b2443a2eb1078e34894 (diff)
downloadpostgresql-e77a1c58e338a1aebf00e3ae82d282f8bd32fe17.tar.gz
postgresql-e77a1c58e338a1aebf00e3ae82d282f8bd32fe17.zip
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.c2
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;
}