From f9d46caa918990d4d4fd8398e79804a2b6ad83bb Mon Sep 17 00:00:00 2001 From: Yoshiyuki Asaba Date: Thu, 11 May 2006 03:00:07 +0000 Subject: [PATCH] Fix buffer over-run in health_check(). If helth_check_user length is greater than 32 byte, buffer over-run was caused by strcpy(). It uses strncpy() instead of strcpy(). Patch contributed by Taiki Yamaguchi. --- child.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/child.c b/child.c index e46822c..3fcab64 100644 --- a/child.c +++ b/child.c @@ -1037,7 +1037,7 @@ int health_check(void) mysp.len = htonl(296); mysp.sp.protoVersion = htonl(PROTO_MAJOR_V2 << 16); strcpy(mysp.sp.database, "template1"); - strcpy(mysp.sp.user, pool_config.health_check_user); + strncpy(mysp.sp.user, pool_config.health_check_user, sizeof(mysp.sp.user) - 1); *mysp.sp.options = '\0'; *mysp.sp.unused = '\0'; *mysp.sp.tty = '\0'; -- 2.39.5