Skip to content

Commit

Permalink
b43legacy/leds: Ensure NUL-termination of LED name string
Browse files Browse the repository at this point in the history
commit 4d77a89 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 f337a54 commit f0f3784
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/broadcom/b43legacy/leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static int b43legacy_register_led(struct b43legacy_wldev *dev,
led->dev = dev;
led->index = led_index;
led->activelow = activelow;
strncpy(led->name, name, sizeof(led->name));
strlcpy(led->name, name, sizeof(led->name));

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

0 comments on commit f0f3784

Please sign in to comment.