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
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>
  • Loading branch information
Michael Büsch authored and Kalle Valo committed Aug 9, 2018
1 parent 2aa650d commit 4d77a89
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 4d77a89

Please sign in to comment.