diff options
author | jkh <jkh@FreeBSD.org> | 1996-12-09 08:22:19 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1996-12-09 08:22:19 +0000 |
commit | 78cf4aee6b346217e9f9fbee836c6c67a8cbda61 (patch) | |
tree | 703f1957c7cb4d3138f4dca933a94c51a76a6ae6 /usr.sbin/sysinstall/variable.c | |
parent | 316f6be0fa40f1f38890e5f7030d808f4de39e18 (diff) | |
download | FreeBSD-src-78cf4aee6b346217e9f9fbee836c6c67a8cbda61.zip FreeBSD-src-78cf4aee6b346217e9f9fbee836c6c67a8cbda61.tar.gz |
As Paul has just pointed out, much of my strncpy() usage was either
bogus or overly complex and really needed to be done more consistently
and sanely throughout - no question about it. Done.
Suggested-By: Paul Traina <pst@Shockwave.COM>
Diffstat (limited to 'usr.sbin/sysinstall/variable.c')
-rw-r--r-- | usr.sbin/sysinstall/variable.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/sysinstall/variable.c b/usr.sbin/sysinstall/variable.c index 7d77d15..013358e 100644 --- a/usr.sbin/sysinstall/variable.c +++ b/usr.sbin/sysinstall/variable.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: variable.c,v 1.10 1996/04/29 06:47:10 jkh Exp $ + * $Id: variable.c,v 1.11 1996/06/12 14:02:13 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -51,15 +51,15 @@ make_variable(char *var, char *value) if (!strcmp(newvar->name, var)) { if (isDebug()) msgDebug("variable %s was %s, now %s\n", newvar->name, newvar->value, value); - strncpy(newvar->value, value, VAR_VALUE_MAX); + SAFE_STRCPY(newvar->value, value); return; } } /* No? Create a new one */ newvar = (Variable *)safe_malloc(sizeof(Variable)); - strncpy(newvar->name, var, VAR_NAME_MAX); - strncpy(newvar->value, value, VAR_VALUE_MAX); + SAFE_STRCPY(newvar->name, var); + SAFE_STRCPY(newvar->value, value); newvar->next = VarHead; VarHead = newvar; if (isDebug()) @@ -75,7 +75,7 @@ variable_set(char *var) msgFatal("NULL variable name & value passed."); else if (!*var) msgDebug("Warning: Zero length name & value passed to variable_set()\n"); - strncpy(tmp, var, VAR_NAME_MAX + VAR_VALUE_MAX); + SAFE_STRCPY(tmp, var); if ((cp = index(tmp, '=')) == NULL) msgFatal("Invalid variable format: %s", var); *(cp++) = '\0'; |