use strlcpy to ensure termination.
the buffer is statically sized so that it works without an allocator, so truncation is the desired effect here.
This commit is contained in:
parent
d24a806584
commit
9d7a8fa9a3
|
@ -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>
|
* Copyright 1996 Matt Thomas <matt@3am-software.com>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
@ -138,7 +138,7 @@ _rtld_load_library(const char *name, const Obj_Entry *refobj, int flags)
|
||||||
|
|
||||||
tmperrorp = dlerror();
|
tmperrorp = dlerror();
|
||||||
if (tmperrorp != NULL) {
|
if (tmperrorp != NULL) {
|
||||||
strncpy(tmperror, tmperrorp, sizeof tmperror);
|
strlcpy(tmperror, tmperrorp, sizeof(tmperror));
|
||||||
tmperrorp = tmperror;
|
tmperrorp = tmperror;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue