]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath5k: ensure led name is null terminated
authorBob Copeland <me@bobcopeland.com>
Fri, 22 Aug 2014 13:18:01 +0000 (09:18 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 28 Aug 2014 18:41:56 +0000 (14:41 -0400)
Add the missing null termination after strncpy().

This isn't actually a buffer overflow in this case since we use
snprintf() appropriately to fill the buffer passed by the caller,
but in the interest of not turning this into a bug down the road,
go ahead and force termination here.

Found by Coverity.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/led.c

index 48a6a69b57bcb6bcce63f23032e7ee629c124d90..2062d1190556b11983234b35c9a76e7cff893367 100644 (file)
@@ -130,6 +130,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led,
 
        led->ah = ah;
        strncpy(led->name, name, sizeof(led->name));
+       led->name[sizeof(led->name)-1] = 0;
        led->led_dev.name = led->name;
        led->led_dev.default_trigger = trigger;
        led->led_dev.brightness_set = ath5k_led_brightness_set;