summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-03-19 14:11:48 +0000
committerEric Engestrom <[email protected]>2019-04-04 13:59:24 +0000
commit9d6ea552638bc1e06ce46e31e0bc070d51f868f9 (patch)
tree5228f6a2486a93c51db455c34e0f1e39277c36fc /src/gallium
parent4633d13854ffb64db476711afd97e00f60c4345a (diff)
gallium/hud: prevent buffer overflow
Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/hud/hud_diskstat.c4
-rw-r--r--src/gallium/auxiliary/hud/hud_nic.c4
-rw-r--r--src/gallium/auxiliary/hud/hud_sensors_temp.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c
index 6860567a26e..23b98c1fa86 100644
--- a/src/gallium/auxiliary/hud/hud_diskstat.c
+++ b/src/gallium/auxiliary/hud/hud_diskstat.c
@@ -213,7 +213,7 @@ add_object_part(const char *basename, const char *name, int objmode)
{
struct diskstat_info *dsi = CALLOC_STRUCT(diskstat_info);
- strcpy(dsi->name, name);
+ snprintf(dsi->name, sizeof(dsi->name), "%s", name);
snprintf(dsi->sysfs_filename, sizeof(dsi->sysfs_filename), "%s/%s/stat",
basename, name);
dsi->mode = objmode;
@@ -226,7 +226,7 @@ add_object(const char *basename, const char *name, int objmode)
{
struct diskstat_info *dsi = CALLOC_STRUCT(diskstat_info);
- strcpy(dsi->name, name);
+ snprintf(dsi->name, sizeof(dsi->name), "%s", name);
snprintf(dsi->sysfs_filename, sizeof(dsi->sysfs_filename), "%s/stat",
basename);
dsi->mode = objmode;
diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c
index 5fab3319db2..a294602b29e 100644
--- a/src/gallium/auxiliary/hud/hud_nic.c
+++ b/src/gallium/auxiliary/hud/hud_nic.c
@@ -114,7 +114,7 @@ query_wifi_bitrate(const struct nic_info *nic, uint64_t *bitrate)
memset(&stats, 0, sizeof(stats));
memset(&req, 0, sizeof(req));
- strcpy(req.ifr_name, nic->name);
+ snprintf(req.ifr_name, sizeof(req.ifr_name), "%s", nic->name);
req.u.data.pointer = &stats;
req.u.data.flags = 1;
req.u.data.length = sizeof(struct iw_statistics);
@@ -145,7 +145,7 @@ query_nic_rssi(const struct nic_info *nic, uint64_t *leveldBm)
memset(&stats, 0, sizeof(stats));
memset(&req, 0, sizeof(req));
- strcpy(req.ifr_name, nic->name);
+ snprintf(req.ifr_name, sizeof(req.ifr_name), "%s", nic->name);
req.u.data.pointer = &stats;
req.u.data.flags = 1;
req.u.data.length = sizeof(struct iw_statistics);
diff --git a/src/gallium/auxiliary/hud/hud_sensors_temp.c b/src/gallium/auxiliary/hud/hud_sensors_temp.c
index c226e89cc42..fe80cabf82f 100644
--- a/src/gallium/auxiliary/hud/hud_sensors_temp.c
+++ b/src/gallium/auxiliary/hud/hud_sensors_temp.c
@@ -259,8 +259,8 @@ create_object(const char *chipname, const char *featurename,
sti->mode = mode;
sti->chip = (sensors_chip_name *) chip;
sti->feature = feature;
- strcpy(sti->chipname, chipname);
- strcpy(sti->featurename, featurename);
+ snprintf(sti->chipname, sizeof(sti->chipname), "%s", chipname);
+ snprintf(sti->featurename, sizeof(sti->featurename), "%s", featurename);
snprintf(sti->name, sizeof(sti->name), "%s.%s", sti->chipname,
sti->featurename);