aboutsummaryrefslogtreecommitdiff
path: root/procps
diff options
context:
space:
mode:
Diffstat (limited to 'procps')
-rw-r--r--procps/sysctl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/procps/sysctl.c b/procps/sysctl.c
index 03a03889e..297a12a85 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -129,7 +129,7 @@ int sysctl_preload_file(const char *filename, int output)
}
while (fgets(oneline, sizeof(oneline) - 1, fp)) {
- oneline[sizeof(oneline) - 1] = 0;
+ oneline[sizeof(oneline) - 1] = '\0';
lineno++;
trim(oneline);
ptr = (char *) oneline;
@@ -156,9 +156,8 @@ int sysctl_preload_file(const char *filename, int output)
while ((*value == ' ' || *value == '\t') && *value != 0)
value++;
- strcpy(buffer, name);
- strcat(buffer, "=");
- strcat(buffer, value);
+ /* safe because sizeof(oneline) == sizeof(buffer) */
+ sprintf(buffer, "%s=%s", name, value);
sysctl_write_setting(buffer, output);
}
fclose(fp);