Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so use strlcpy to ensure termination.



details:   https://anonhg.NetBSD.org/src/rev/9e1dca71d4ab
branches:  trunk
changeset: 460229:9e1dca71d4ab
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Oct 13 20:18:42 2019 +0000

description:
use strlcpy to ensure termination.

the buffer is statically sized so that it works without an
allocator, so truncation is the desired effect here.

diffstat:

 libexec/ld.elf_so/search.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 04b0f3aabb94 -r 9e1dca71d4ab libexec/ld.elf_so/search.c
--- a/libexec/ld.elf_so/search.c        Sun Oct 13 19:39:15 2019 +0000
+++ b/libexec/ld.elf_so/search.c        Sun Oct 13 20:18:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: search.c,v 1.25 2019/01/12 18:58:10 christos Exp $      */
+/*     $NetBSD: search.c,v 1.26 2019/10/13 20:18:42 mrg Exp $   */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: search.c,v 1.25 2019/01/12 18:58:10 christos Exp $");
+__RCSID("$NetBSD: search.c,v 1.26 2019/10/13 20:18:42 mrg Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -138,7 +138,7 @@
 
        tmperrorp = dlerror();
        if (tmperrorp != NULL) {
-               strncpy(tmperror, tmperrorp, sizeof tmperror);
+               strlcpy(tmperror, tmperrorp, sizeof(tmperror));
                tmperrorp = tmperror;
        }
 



Home | Main Index | Thread Index | Old Index