All of lore.kernel.org
 help / color / mirror / Atom feed
* [nft PATCH] main: Fix for return of uninitialized variable in nft_run_cmd_from_filename()
@ 2017-09-21 13:10 Phil Sutter
  2017-09-27 12:11 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2017-09-21 13:10 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

If scanner_read_file() failed, the function would return an
uninitialized value.

Fixes: 3db28321b64a6 ("src: add nft_run_cmd_*() functions")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 702ef30237b3b..8e7b586d347cc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -351,8 +351,10 @@ static int nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename)
 
 	parser_init(nft->nf_sock, &nft->cache, &state, &msgs, nft->debug_mask);
 	scanner = scanner_init(&state);
-	if (scanner_read_file(scanner, filename, &internal_location) < 0)
+	if (scanner_read_file(scanner, filename, &internal_location) < 0) {
+		rc = NFT_EXIT_FAILURE;
 		goto err;
+	}
 
 	if (nft_run(nft, nft->nf_sock, scanner, &state, &msgs) != 0)
 		rc = NFT_EXIT_FAILURE;
-- 
2.13.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [nft PATCH] main: Fix for return of uninitialized variable in nft_run_cmd_from_filename()
  2017-09-21 13:10 [nft PATCH] main: Fix for return of uninitialized variable in nft_run_cmd_from_filename() Phil Sutter
@ 2017-09-27 12:11 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-09-27 12:11 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netfilter-devel

On Thu, Sep 21, 2017 at 03:10:39PM +0200, Phil Sutter wrote:
> If scanner_read_file() failed, the function would return an
> uninitialized value.

Also applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-27 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 13:10 [nft PATCH] main: Fix for return of uninitialized variable in nft_run_cmd_from_filename() Phil Sutter
2017-09-27 12:11 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.