Module Name: src
Committed By: christos
Date: Sat Mar 29 23:25:57 UTC 2025
Modified Files:
src/external/bsd/blocklist/lib: bl.c
Log Message:
Don't use strlcpy() because it will keep going trying to find the end of the
input string (thanks riastradh)
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/blocklist/lib/bl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/blocklist/lib/bl.c
diff -u src/external/bsd/blocklist/lib/bl.c:1.7 src/external/bsd/blocklist/lib/bl.c:1.8
--- src/external/bsd/blocklist/lib/bl.c:1.7 Wed Mar 26 12:45:22 2025
+++ src/external/bsd/blocklist/lib/bl.c Sat Mar 29 19:25:57 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: bl.c,v 1.7 2025/03/26 16:45:22 christos Exp $ */
+/* $NetBSD: bl.c,v 1.8 2025/03/29 23:25:57 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: bl.c,v 1.7 2025/03/26 16:45:22 christos Exp $");
+__RCSID("$NetBSD: bl.c,v 1.8 2025/03/29 23:25:57 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -546,8 +546,8 @@ bl_recv(bl_t b)
if (rem == 0)
bi->bi_msg[0] = '\0';
else {
- rem = MIN(sizeof(bi->bi_msg), rem + 1);
- strlcpy(bi->bi_msg, ub.bl.bl_data, rem);
+ rem = MIN(sizeof(bi->bi_msg) - 1, rem);
+ memcpy(bi->bi_msg, ub.bl.bl_data, rem);
bi->bi_msg[sizeof(bi->bi_msg) - 1] = '\0';
}
return bi;