Skip to content

Commit

Permalink
b43/leds: Ensure NUL-termination of LED name string
Browse files Browse the repository at this point in the history
commit 2aa650d upstream.

strncpy might not NUL-terminate the string, if the name equals the buffer size.
Use strlcpy instead.

Signed-off-by: Michael Buesch <m@bues.ch>
Cc: stable@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michael Buesch authored and Greg Kroah-Hartman committed Sep 5, 2018
1 parent f0f3784 commit e16bbde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/broadcom/b43/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int b43_register_led(struct b43_wldev *dev, struct b43_led *led,
led->wl = dev->wl;
led->index = led_index;
led->activelow = activelow;
strncpy(led->name, name, sizeof(led->name));
strlcpy(led->name, name, sizeof(led->name));
atomic_set(&led->state, 0);

led->led_dev.name = led->name;
Expand Down

0 comments on commit e16bbde

Please sign in to comment.