the size of the timestamp buffer.
One could find something like:
strcpy(string, _("Average"));
in pidstat.c and sar.c. Yet, we don't know whether the translation
message for "Average" will fit in target string buffer. Hence we
replaced the previous expression with something like:
strncpy(string, _("Average"), length_of_string_buffer);
string[lenght_of_string_buffer - 1] = '\0';
* sar: Decrease column width for sensor device name (temperature,
voltage inputs and fans statistics).
* Remove unnecessary arguments from functions in pr_stats.c.
+ * sar and pidstat: Check that _("Average") string doesn't exceed
+ the size of the timestamp buffer.
* [Ivana Varekova]: Added option -h to iostat. This option makes
the device utilization report easier to read with long device
names.
{
char string[16];
- strcpy(string, _("Average:"));
+ strncpy(string, _("Average:"), 16);
+ string[15] = '\0';
write_stats_core(2, curr, dis, TRUE, string, string);
}
else
itv = g_itv;
- strcpy(timestamp[curr], _("Average:"));
+ strncpy(timestamp[curr], _("Average:"), TIMESTAMP_LEN);
+ timestamp[curr][TIMESTAMP_LEN - 1] = '\0';
strcpy(timestamp[!curr], timestamp[curr]);
/* Test stdout */