Commit daf9669b authored by Bob Copeland's avatar Bob Copeland Committed by John W. Linville

ath5k: ensure led name is null terminated

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: default avatarBob Copeland <me@bobcopeland.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent e6938ea4
...@@ -130,6 +130,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led, ...@@ -130,6 +130,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led,
led->ah = ah; led->ah = ah;
strncpy(led->name, name, sizeof(led->name)); strncpy(led->name, name, sizeof(led->name));
led->name[sizeof(led->name)-1] = 0;
led->led_dev.name = led->name; led->led_dev.name = led->name;
led->led_dev.default_trigger = trigger; led->led_dev.default_trigger = trigger;
led->led_dev.brightness_set = ath5k_led_brightness_set; led->led_dev.brightness_set = ath5k_led_brightness_set;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment