aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortoge <toge.mail@gmail.com>2021-11-23 22:53:50 +0900
committertoge <toge.mail@gmail.com>2021-11-23 22:53:50 +0900
commitafec7cf56e0eac14cdd875c77b1984738f7eef17 (patch)
tree4e9ea5a6182f6c5acacbf79e9c16ce806793d3a4 /src
parent80025c691bda84c4396f507aa4566b7af367210e (diff)
insert null at end of strncpy target array.
Diffstat (limited to 'src')
-rw-r--r--src/mixer_plugin.c2
-rw-r--r--src/pcm_plugin.c3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/mixer_plugin.c b/src/mixer_plugin.c
index b7fcc0b..a07b8f6 100644
--- a/src/mixer_plugin.c
+++ b/src/mixer_plugin.c
@@ -83,6 +83,7 @@ static int mixer_plug_get_elem_id(struct mixer_plug_data *plug_data,
strncpy((char *)id->name, (char *)ctl->name,
sizeof(id->name) - 1);
+ ((char *)id->name)[sizeof(id->name) - 1] = '\0';
return 0;
}
@@ -101,6 +102,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) - 1);
+ einfo->value.enumerated.name[sizeof(einfo->value.enumerated.name) - 1] = '\0';
return 0;
}
diff --git a/src/pcm_plugin.c b/src/pcm_plugin.c
index 610b5d9..47bf4a5 100644
--- a/src/pcm_plugin.c
+++ b/src/pcm_plugin.c
@@ -154,8 +154,11 @@ static int pcm_plug_info(struct pcm_plug_data *plug_data,
}
strncpy((char *)info->id, name, sizeof(info->id) - 1);
+ ((char *)info->id)[sizeof(info->id) - 1] = '\0';
strncpy((char *)info->name, name, sizeof(info->name) - 1);
+ ((char *)info->name)[sizeof(info->name) - 1] = '\0';
strncpy((char *)info->subname, name, sizeof(info->subname) - 1);
+ ((char *)info->subname)[sizeof(info->subname) - 1] = '\0';
info->subdevices_count = 1;