diff options
author | 2016-02-24 20:52:53 +0000 | |
---|---|---|
committer | 2016-02-24 20:52:53 +0000 | |
commit | 365b8ebf7e5f5ef9cd3ec904b09c032250e9afa4 (patch) | |
tree | 45de8ff4be51b9da1fa422bfa0cb705756a0f7e5 /lib/libc/asr/asr.c | |
parent | Restore validity checks for the disklabels read from disk. They (diff) | |
download | wireguard-openbsd-365b8ebf7e5f5ef9cd3ec904b09c032250e9afa4.tar.xz wireguard-openbsd-365b8ebf7e5f5ef9cd3ec904b09c032250e9afa4.zip |
Avoid a possible double-free if the "search" keyword is used multiple times.
ok jca@ gilles@
Diffstat (limited to 'lib/libc/asr/asr.c')
-rw-r--r-- | lib/libc/asr/asr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c index 7095b9200a1..36fd724e8cb 100644 --- a/lib/libc/asr/asr.c +++ b/lib/libc/asr/asr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr.c,v 1.50 2015/12/16 16:32:30 deraadt Exp $ */ +/* $OpenBSD: asr.c,v 1.51 2016/02/24 20:52:53 eric Exp $ */ /* * Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org> * @@ -565,8 +565,10 @@ pass0(char **tok, int n, struct asr_ctx *ac) } } else if (!strcmp(tok[0], "search")) { /* resolv.conf says the last line wins */ - for (i = 0; i < ASR_MAXDOM; i++) + for (i = 0; i < ASR_MAXDOM; i++) { free(ac->ac_dom[i]); + ac->ac_dom[i] = NULL; + } ac->ac_domcount = 0; for (i = 1; i < n; i++) asr_ctx_add_searchdomain(ac, tok[i]); |