diff options
Diffstat (limited to 'procps')
-rw-r--r-- | procps/sysctl.c | 7 |
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) | |||
129 | } | 129 | } |
130 | 130 | ||
131 | while (fgets(oneline, sizeof(oneline) - 1, fp)) { | 131 | while (fgets(oneline, sizeof(oneline) - 1, fp)) { |
132 | oneline[sizeof(oneline) - 1] = 0; | 132 | oneline[sizeof(oneline) - 1] = '\0'; |
133 | lineno++; | 133 | lineno++; |
134 | trim(oneline); | 134 | trim(oneline); |
135 | ptr = (char *) oneline; | 135 | ptr = (char *) oneline; |
@@ -156,9 +156,8 @@ int sysctl_preload_file(const char *filename, int output) | |||
156 | 156 | ||
157 | while ((*value == ' ' || *value == '\t') && *value != 0) | 157 | while ((*value == ' ' || *value == '\t') && *value != 0) |
158 | value++; | 158 | value++; |
159 | strcpy(buffer, name); | 159 | /* safe because sizeof(oneline) == sizeof(buffer) */ |
160 | strcat(buffer, "="); | 160 | sprintf(buffer, "%s=%s", name, value); |
161 | strcat(buffer, value); | ||
162 | sysctl_write_setting(buffer, output); | 161 | sysctl_write_setting(buffer, output); |
163 | } | 162 | } |
164 | fclose(fp); | 163 | fclose(fp); |