Skip to content

Commit

Permalink
interface/guigame: avoid string overflow and string overlap warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Jun 11, 2021
1 parent cde9b0a commit 4b9b6a4
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions src/guigame.c
Expand Up @@ -460,29 +460,20 @@ static u8 ds3_mac[6];
static u8 dg_mac[6];
static char ds3_str[18];
static char dg_str[18];
static char vid_str[4];
static char pid_str[4];
static char rev_str[4];
static char vid_str[5];
static char pid_str[5];
static char rev_str[5];
static char hci_str[26];
static char lmp_str[26];
static char man_str[4];
static char man_str[5];
static int ds3macset = 0;
static int dgmacset = 0;
static int dg_discon = 0;
static int ver_set = 0, feat_set = 0;

static char *bdaddr_to_str(u8 *bdaddr, char *addstr)
{
int i;

memset(addstr, 0, sizeof(addstr));

for (i = 0; i < 6; i++) {
sprintf(addstr, "%s%02X", addstr, bdaddr[i]);

if (i < 5)
sprintf(addstr, "%s:", addstr);
}
snprintf(addstr, 18, "%02X:%02X:%02X:%02X:%02X:%02X", bdaddr[0], bdaddr[1], bdaddr[2], bdaddr[3], bdaddr[4], bdaddr[5]);

return addstr;
}
Expand Down

0 comments on commit 4b9b6a4

Please sign in to comment.