summaryrefslogtreecommitdiff
path: root/usr.sbin/dvmrpd/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/dvmrpd/parse.y')
-rw-r--r--usr.sbin/dvmrpd/parse.y13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y
index 4cde820bf4b..65966206072 100644
--- a/usr.sbin/dvmrpd/parse.y
+++ b/usr.sbin/dvmrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.36 2018/07/11 07:39:22 krw Exp $ */
+/* $OpenBSD: parse.y,v 1.37 2018/09/07 07:35:30 miko Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -834,17 +834,12 @@ cmdline_symset(char *s)
{
char *sym, *val;
int ret;
- size_t len;
if ((val = strrchr(s, '=')) == NULL)
return (-1);
-
- len = strlen(s) - strlen(val) + 1;
- if ((sym = malloc(len)) == NULL)
- errx(1, "cmdline_symset: malloc");
-
- strlcpy(sym, s, len);
-
+ sym = strndup(s, val - s);
+ if (sym == NULL)
+ errx(1, "%s: strndup", __func__);
ret = symset(sym, val + 1, 1);
free(sym);