summaryrefslogtreecommitdiff
path: root/usr.sbin/ypldap/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ypldap/parse.y')
-rw-r--r--usr.sbin/ypldap/parse.y13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.sbin/ypldap/parse.y b/usr.sbin/ypldap/parse.y
index c55e8ab876b..6048a3586c9 100644
--- a/usr.sbin/ypldap/parse.y
+++ b/usr.sbin/ypldap/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.28 2018/07/11 07:39:22 krw Exp $ */
+/* $OpenBSD: parse.y,v 1.29 2018/09/07 07:35:31 miko Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -930,17 +930,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, "%s", __func__);
-
- (void)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);