Fix cut and paste off-by-one error in hccontrol(8).

Make sure strncpy() doesn't write beyond its given buffer.

PR:		245739
MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2020-04-19 14:25:56 +00:00
parent ea01149104
commit 6cf6c1510d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=360095

View File

@ -134,6 +134,7 @@ hci_hmode2str(int mode, char *buffer, int size)
int n;
memset(buffer, 0, size);
size--;
for (n = 0; n < SIZE(t); n++) {
int len = strlen(buffer);
@ -347,6 +348,7 @@ hci_features2str(uint8_t *features, char *buffer, int size)
memset(buffer, 0, size);
len1 = 0;
size--;
for (n = 0; n < SIZE(t); n++) {
for (i = 0; i < SIZE(t[n]); i++) {
@ -460,6 +462,7 @@ hci_le_features2str(uint8_t *features, char *buffer, int size)
memset(buffer, 0, size);
len1 = 0;
size--;
for (n = 0; n < SIZE(t); n++) {
for (i = 0; i < SIZE(t[n]); i++) {