mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-19 15:33:56 +00:00
Use MAXPATHLEN rather than the size of an extern array when copying the
kernel name. Also consistenly use strlcpy(). Suggested by: Warner Losh
This commit is contained in:
parent
cf0d2bb216
commit
cd67ac41ae
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219468
@ -1741,7 +1741,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
|
|||||||
|
|
||||||
env = getenv("kernelname");
|
env = getenv("kernelname");
|
||||||
if (env != NULL)
|
if (env != NULL)
|
||||||
strlcpy(kernelname, env, sizeof(kernelname));
|
strlcpy(kernelname, env, MAXPATHLEN);
|
||||||
|
|
||||||
#ifdef XENHVM
|
#ifdef XENHVM
|
||||||
if (inw(0x10) == 0x49d2) {
|
if (inw(0x10) == 0x49d2) {
|
||||||
|
@ -792,7 +792,7 @@ ia64_init(void)
|
|||||||
|
|
||||||
p = getenv("kernelname");
|
p = getenv("kernelname");
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
strncpy(kernelname, p, sizeof(kernelname) - 1);
|
strlcpy(kernelname, p, MAXPATHLEN);
|
||||||
freeenv(p);
|
freeenv(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,7 +540,7 @@ powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel,
|
|||||||
*/
|
*/
|
||||||
env = getenv("kernelname");
|
env = getenv("kernelname");
|
||||||
if (env != NULL) {
|
if (env != NULL) {
|
||||||
strlcpy(kernelname, env, sizeof(kernelname));
|
strlcpy(kernelname, env, MAXPATHLEN);
|
||||||
freeenv(env);
|
freeenv(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
|
|||||||
init_param2(physmem);
|
init_param2(physmem);
|
||||||
env = getenv("kernelname");
|
env = getenv("kernelname");
|
||||||
if (env != NULL) {
|
if (env != NULL) {
|
||||||
strlcpy(kernelname, env, sizeof(kernelname));
|
strlcpy(kernelname, env, MAXPATHLEN);
|
||||||
freeenv(env);
|
freeenv(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
|
|||||||
|
|
||||||
env = getenv("kernelname");
|
env = getenv("kernelname");
|
||||||
if (env != NULL) {
|
if (env != NULL) {
|
||||||
strlcpy(kernelname, env, sizeof(kernelname));
|
strlcpy(kernelname, env, MAXPATHLEN);
|
||||||
freeenv(env);
|
freeenv(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
/* Global variables for the kernel. */
|
/* Global variables for the kernel. */
|
||||||
|
|
||||||
/* 1.1 */
|
/* 1.1 */
|
||||||
extern char kernelname[MAXPATHLEN];
|
extern char kernelname[/*MAXPATHLEN*/];
|
||||||
|
|
||||||
extern int tick; /* usec per tick (1000000 / hz) */
|
extern int tick; /* usec per tick (1000000 / hz) */
|
||||||
extern int hz; /* system clock's frequency */
|
extern int hz; /* system clock's frequency */
|
||||||
|
Loading…
Reference in New Issue
Block a user