pgpool2.git / summary / log / commit / refs

commit    178b06ff37b6e61587fb16d2088bb06cbe182daf
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Mon Nov 09 01:29:16 2026 +0000

    Fix to use snprintf() instead of strlcpy() in pgproto.
    
    Commit 1f40c4fe7 modified pgproto to use strlcpy() to generate the v2
    protocol startup packet. Unfortunately strlcpy() is only available in
    glibc 2.38 or after, which is provided by Red Hat 10 or newer. Thus
    Red Hat 8 or 9 failed to build pgproto.
    
    This commit replaces strlcpy() with snprintf().
    
    Author: Tatsuo Ishii <ishii@postgresql.org>
    Backpatch-through: master only


src/tools/pgproto/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/pgproto/main.c b/src/tools/pgproto/main.c index 452eb552b..ffe4e679c 100644 --- a/src/tools/pgproto/main.c +++ b/src/tools/pgproto/main.c @@ -715,11 +715,11 @@ connect_v2(char *host, char *port, char *user, char *database) write_it(fd, &nlen, sizeof(int)); /* protocol version */ memset(buf1, 0, sizeof(buf1)); - strlcpy(buf1, database, sizeof(buf1)); + snprintf(buf1, sizeof(buf1), "%s", database); write_it(fd, buf1, sizeof(buf1)); /* database */ memset(buf2, 0, sizeof(buf2)); - strlcpy(buf2, user, sizeof(buf2)); + snprintf(buf2, sizeof(buf2), "%s", user); write_it(fd, buf2, sizeof(buf2)); /* user */ memset(buf1, 0, sizeof(buf1)); [parent: 1f40c4fe724d]