Skip to contentSkip to conversation

af_packet: use sizeof instead of constant in spkt_device

PATCH Applied Daniel Borkmann 2 participants 2 messages Jun 10, 2012 – Jun 11, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 af_packet: use sizeof instead of constant in spkt_device

This small patch removes access to the last element of the spkt_device array through a constant. Instead, it is accessed by sizeof() to respect possible changes in if_packet.h.

---
 net/packet/af_packet.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/packet/af_packet.c +1 -1
index 0f66174..06ff8e1 100644
@@ -1476,7 +1476,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
 	 *	Find the device first to size check it
 	 */
 
-	saddr->spkt_device[13] = 0;
+	saddr->spkt_device[sizeof(saddr->spkt_device) - 1] = 0;
 retry:
 	rcu_read_lock();
 	dev = dev_get_by_name_rcu(sock_net(sk), saddr->spkt_device);
maintainer Applied
#1 lore raw

From: Daniel Borkmann <[email protected]>
Date: Sun, 10 Jun 2012 20:59:28 +0200

Quoted 5 lines

This small patch removes access to the last element of the spkt_device array through a constant. Instead, it is accessed by sizeof() to respect possible changes in if_packet.h.

Applied, thanks.