This fixes various issues found when sanitizers are enabled.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
if ((filter_mask & PACKET_FILTER_SHOW_INDEX) &&
index != HCI_DEV_NONE) {
if (use_color()) {
- n = sprintf(ts_str + ts_pos, "%s", COLOR_INDEX_LABEL);
+ n = snprintf(ts_str + ts_pos, sizeof(ts_str) - ts_pos,
+ "%s", COLOR_INDEX_LABEL);
if (n > 0)
ts_pos += n;
}
if (!is_init)
return;
- for (i = 0; mount_table[i].fstype; i++) {
+ for (i = 0; mount_table[i].fstype && mount_table[i].target; i++) {
struct stat st;
if (lstat(mount_table[i].target, &st) < 0) {
if (setup->rsep) {
cap = avdtp_get_codec(setup->rsep->sep);
rsep_codec = (struct avdtp_media_codec_capability *) cap->data;
+ /* Check that codec really match after closing */
+ if (sep->codec != rsep_codec->media_codec_type)
+ setup->rsep = NULL;
}
- if (!setup->rsep || sep->codec != rsep_codec->media_codec_type)
+ if (!setup->rsep)
setup->rsep = find_remote_sep(setup->chan, sep);
if (!setup->rsep) {
memset(&dev, 0, sizeof(dev));
if (name) {
- strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE);
+ strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE - 1);
dev.name[UINPUT_MAX_NAME_SIZE - 1] = '\0';
}
struct bnep_connadd_req req;
memset(&req, 0, sizeof(req));
- strncpy(req.device, dev, 16);
+ strncpy(req.device, dev, 15);
req.device[15] = '\0';
req.sock = sk;
session->io = g_io_channel_unix_new(dup_fd);
session->src = local_role;
session->dst = remote_role;
- strncpy(session->iface, iface, 16);
+ strncpy(session->iface, iface, 15);
session->iface[15] = '\0';
g_io_channel_set_close_on_unref(session->io, TRUE);
}
data = read_mult_data_new(server, chan, opcode, length / 2);
- if (!data)
- goto error;
for (i = 0; i < data->num_handles; i++)
data->handles[i] = get_le16(pdu + i * 2);
char *line, *bytes;
int i;
- line = g_malloc(strlen(prefix) + (16 * 3) + 2);
- sprintf(line, "%s ", prefix);
- bytes = line + strlen(prefix) + 1;
+ if (prefix) {
+ line = g_malloc(strlen(prefix) + (16 * 3) + 2);
+ sprintf(line, "%s ", prefix);
+ bytes = line + strlen(prefix) + 1;
+ } else {
+ line = g_malloc((16 * 3) + 2);
+ bytes = line + 1;
+ }
for (i = 0; i < len; ++i) {
sprintf(bytes, "%2.2x ", data[i]);
{
int i;
- for (i = 0; mount_table[i].fstype; i++) {
+ for (i = 0; mount_table[i].fstype && mount_table[i].target; i++) {
struct stat st;
if (lstat(mount_table[i].target, &st) < 0) {