From: Vadim Zhukov Date: Tue, 28 Jul 2015 14:08:52 +0000 (+0000) Subject: Fix keepenv handling. Initially reported by Ze Loff on misc@. X-Git-Tag: v0.1~52 X-Git-Url: https://git.armaanb.net/?p=opendoas.git;a=commitdiff_plain;h=73e0aef5b2bb0bc50ca67870b02b71d77150f312 Fix keepenv handling. Initially reported by Ze Loff on misc@. tedu@ agrees. --- diff --git a/doas.c b/doas.c index 5fc1889..91b3f68 100644 --- a/doas.c +++ b/doas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: doas.c,v 1.27 2015/07/26 22:44:33 tedu Exp $ */ +/* $OpenBSD: doas.c,v 1.28 2015/07/27 15:38:11 espie Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -256,8 +256,10 @@ copyenv(const char **oldenvp, struct rule *rule) size_t j; for (j = 0; j < nextras; j++) { if (strcmp(extra[j], safeset[i]) == 0) { - extra[j--] = extra[nextras--]; + nextras--; + extra[j] = extra[nextras]; extra[nextras] = NULL; + j--; } } }