summaryrefslogtreecommitdiff
path: root/usr.sbin/rad
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/rad')
-rw-r--r--usr.sbin/rad/parse.y13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/rad/parse.y b/usr.sbin/rad/parse.y
index 45947eed6f8..87acb6f3175 100644
--- a/usr.sbin/rad/parse.y
+++ b/usr.sbin/rad/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.8 2018/08/03 13:14:46 florian Exp $ */
+/* $OpenBSD: parse.y,v 1.9 2018/09/07 07:35:31 miko Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -914,17 +914,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);