Skip to content

Commit 6fa30e1

Browse files
committed
ANDROID: xt_quota2: clear quota2_log message before sending
Initialize message buffer for quota2_log to avoid sending random data. Bug: 196046570 Test: passed netd test suites Fixes: 10cda83af99d ("ANDROID: netfilter: xt_quota2: adding the original quota2 from xtables-addons") Signed-off-by: Todd Kjos <tkjos@google.com> Change-Id: Ic9f34aaa2593809b375fc649b74567190c99dc62
1 parent 4bf6d82 commit 6fa30e1

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

net/netfilter/xt_quota2.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,16 @@ static void quota2_log(unsigned int hooknum,
106106
return;
107107
}
108108
pm = nlmsg_data(nlh);
109+
memset(pm, 0, sizeof(*pm));
109110
if (skb->tstamp.tv64 == 0)
110111
__net_timestamp((struct sk_buff *)skb);
111-
pm->data_len = 0;
112112
pm->hook = hooknum;
113113
if (prefix != NULL)
114114
strlcpy(pm->prefix, prefix, sizeof(pm->prefix));
115-
else
116-
*(pm->prefix) = '\0';
117115
if (in)
118116
strlcpy(pm->indev_name, in->name, sizeof(pm->indev_name));
119-
else
120-
pm->indev_name[0] = '\0';
121-
122117
if (out)
123118
strlcpy(pm->outdev_name, out->name, sizeof(pm->outdev_name));
124-
else
125-
pm->outdev_name[0] = '\0';
126119

127120
NETLINK_CB(log_skb).dst_group = 1;
128121
pr_debug("throwing 1 packets to netlink group 1\n");

0 commit comments

Comments
 (0)