diff mbox

[nftables,v2] src: rule: fix crash in set listing

Message ID 89f7e3e3f3a65a85381e04e8e0d12dd1c3069f73.1396944817.git.anarey@gmail.com
State Accepted
Headers show

Commit Message

Ana Rey April 8, 2014, 8:19 a.m. UTC
It fixes an invalid read that is shown by valgrind.

==3962== Invalid read of size 4
==3962==    at 0x407040: do_command (rule.c:692)
==3962==    by 0x40588C: nft_run (main.c:183)
==3962==    by 0x405469: main (main.c:334)
==3962==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

Signed-off-by: Ana Rey <anarey@gmail.com>
---
[Changes in v2]
*  I fix description and subject in this patch.


 src/rule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo Neira Ayuso April 8, 2014, 8:30 a.m. UTC | #1
On Tue, Apr 08, 2014 at 10:19:41AM +0200, Ana Rey wrote:
> It fixes an invalid read that is shown by valgrind.
> 
> ==3962== Invalid read of size 4
> ==3962==    at 0x407040: do_command (rule.c:692)
> ==3962==    by 0x40588C: nft_run (main.c:183)
> ==3962==    by 0x405469: main (main.c:334)
> ==3962==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

Applied, thanks Ana.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/src/rule.c b/src/rule.c
index 00dedf5..18ae6b1 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -674,7 +674,7 @@  static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd)
 				return -1;
 			set_print(set);
 		}
-		break;
+		return 0;
 	case CMD_OBJ_SET:
 		if (netlink_get_set(ctx, &cmd->handle, &cmd->location) < 0)
 			return -1;