33 lines
1.3 KiB
Text
33 lines
1.3 KiB
Text
Do not use sprintf(3) %n.
|
|
|
|
Index: editor/options.c
|
|
--- editor/options.c.orig
|
|
+++ editor/options.c
|
|
@@ -405,22 +405,22 @@ int save_setup (const char *file)
|
|
|
|
for (i = 0; string_options[i].name; i++) {
|
|
if (*string_options[i].value) {
|
|
- sprintf (p, "%s = %s\n%n", string_options[i].name, *string_options[i].value, &r);
|
|
+ r = sprintf (p, "%s = %s\n", string_options[i].name, *string_options[i].value);
|
|
p += r;
|
|
}
|
|
}
|
|
for (i = 0; integer_options[i].name; i++) {
|
|
if (integer_options[i].type == TYPE_HIDDEN_HEX_VALUE)
|
|
- sprintf (p, "%s = 0x%X\n%n", integer_options[i].name, *integer_options[i].value, &r);
|
|
+ r = sprintf (p, "%s = 0x%X\n", integer_options[i].name, *integer_options[i].value);
|
|
else
|
|
- sprintf (p, "%s = %d\n%n", integer_options[i].name, *integer_options[i].value, &r);
|
|
+ r = sprintf (p, "%s = %d\n", integer_options[i].name, *integer_options[i].value);
|
|
p += r;
|
|
}
|
|
for (i = 0; color_options[i].name; i++) {
|
|
if (color_options[i].cname)
|
|
- sprintf (p, "%s = %s\n%n", color_options[i].name, color_options[i].cname, &r);
|
|
+ r = sprintf (p, "%s = %s\n", color_options[i].name, color_options[i].cname);
|
|
else
|
|
- sprintf (p, "%s = %d\n%n", color_options[i].name, *color_options[i].value, &r);
|
|
+ r = sprintf (p, "%s = %d\n", color_options[i].name, *color_options[i].value);
|
|
p += r;
|
|
}
|
|
*p = 0;
|