Date: Mon, 9 Jan 2017 05:41:47 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311746 - stable/11/libexec/talkd Message-ID: <201701090541.v095fltn098646@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Jan 9 05:41:47 2017 New Revision: 311746 URL: https://svnweb.freebsd.org/changeset/base/311746 Log: MFC r310608: Avoid use after free. Modified: stable/11/libexec/talkd/table.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/talkd/table.c ============================================================================== --- stable/11/libexec/talkd/table.c Mon Jan 9 05:26:00 2017 (r311745) +++ stable/11/libexec/talkd/table.c Mon Jan 9 05:41:47 2017 (r311746) @@ -82,14 +82,15 @@ static TABLE_ENTRY *table = NIL; CTL_MSG * find_match(CTL_MSG *request) { - TABLE_ENTRY *ptr; + TABLE_ENTRY *ptr, *next; time_t current_time; gettimeofday(&tp, NULL); current_time = tp.tv_sec; if (debug) print_request("find_match", request); - for (ptr = table; ptr != NIL; ptr = ptr->next) { + for (ptr = table; ptr != NIL; ptr = next) { + next = ptr->next; if ((ptr->time - current_time) > MAX_LIFE) { /* the entry is too old */ if (debug) @@ -115,7 +116,7 @@ find_match(CTL_MSG *request) CTL_MSG * find_request(CTL_MSG *request) { - TABLE_ENTRY *ptr; + TABLE_ENTRY *ptr, *next; time_t current_time; gettimeofday(&tp, NULL); @@ -126,7 +127,8 @@ find_request(CTL_MSG *request) */ if (debug) print_request("find_request", request); - for (ptr = table; ptr != NIL; ptr = ptr->next) { + for (ptr = table; ptr != NIL; ptr = next) { + next = ptr->next; if ((ptr->time - current_time) > MAX_LIFE) { /* the entry is too old */ if (debug)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701090541.v095fltn098646>