aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Wilson <simonrules@users.noreply.github.com>2021-11-16 10:13:08 -0700
committerGitHub <noreply@github.com>2021-11-16 10:13:08 -0700
commit80025c691bda84c4396f507aa4566b7af367210e (patch)
treee496a9079e9d2c21ce9f19f6c7eb63867c179b77
parent3f712873812610206d8eeb25d6df7cb3758811d5 (diff)
parentb3e379e2b24455afc75272dd0f3cb2e9d4600024 (diff)
Merge pull request #220 from toge/fix-strncpy-warnings
fix strncpy warnings
-rw-r--r--src/mixer_plugin.c4
-rw-r--r--src/pcm_plugin.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/mixer_plugin.c b/src/mixer_plugin.c
index 34117a9..b7fcc0b 100644
--- a/src/mixer_plugin.c
+++ b/src/mixer_plugin.c
@@ -82,7 +82,7 @@ static int mixer_plug_get_elem_id(struct mixer_plug_data *plug_data,
id->iface = ctl->iface;
strncpy((char *)id->name, (char *)ctl->name,
- sizeof(id->name));
+ sizeof(id->name) - 1);
return 0;
}
@@ -100,7 +100,7 @@ static int mixer_plug_info_enum(struct snd_control *ctl,
strncpy(einfo->value.enumerated.name,
val->texts[einfo->value.enumerated.item],
- sizeof(einfo->value.enumerated.name));
+ sizeof(einfo->value.enumerated.name) - 1);
return 0;
}
diff --git a/src/pcm_plugin.c b/src/pcm_plugin.c
index 15bfc80..610b5d9 100644
--- a/src/pcm_plugin.c
+++ b/src/pcm_plugin.c
@@ -153,9 +153,9 @@ static int pcm_plug_info(struct pcm_plug_data *plug_data,
return ret;
}
- strncpy((char *)info->id, name, sizeof(info->id));
- strncpy((char *)info->name, name, sizeof(info->name));
- strncpy((char *)info->subname, name, sizeof(info->subname));
+ strncpy((char *)info->id, name, sizeof(info->id) - 1);
+ strncpy((char *)info->name, name, sizeof(info->name) - 1);
+ strncpy((char *)info->subname, name, sizeof(info->subname) - 1);
info->subdevices_count = 1;