Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153411788
D42240.id128881.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D42240.id128881.diff
View Options
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c
--- a/usr.sbin/bsdinstall/partedit/gpart_ops.c
+++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c
@@ -62,12 +62,13 @@
while (errmsg[0] == ' ')
errmsg++;
if (errmsg[0] != '\0')
- sprintf(message, "%s%s. %s", explanation,
- strerror(error), errmsg);
+ snprintf(message, sizeof(message), "%s%s. %s",
+ explanation, strerror(error), errmsg);
else
- sprintf(message, "%s%s", explanation, strerror(error));
+ snprintf(message, sizeof(message), "%s%s", explanation,
+ strerror(error));
} else {
- sprintf(message, "%s%s", explanation, errmsg);
+ snprintf(message, sizeof(message), "%s%s", explanation, errmsg);
}
bsddialog_initconf(&conf);
@@ -263,7 +264,9 @@
if (!is_scheme_bootable(items[choice].name)) {
char message[512];
- sprintf(message, "This partition scheme (%s) is not "
+
+ snprintf(message, sizeof(message),
+ "This partition scheme (%s) is not "
"bootable on this platform. Are you sure you want "
"to proceed?", items[choice].name);
conf.button.default_cancel = true;
@@ -298,7 +301,9 @@
if (!is_scheme_bootable(scheme)) {
char message[512];
- sprintf(message, "This partition scheme (%s) is not "
+
+ snprintf(message, sizeof(message),
+ "This partition scheme (%s) is not "
"bootable on this platform. Are you sure you want "
"to proceed?", scheme);
conf.button.default_cancel = true;
@@ -484,10 +489,11 @@
}
/* Shell out to gpart for partcode for now */
- sprintf(command, "gpart bootcode -p %s -i %s %s",
+ snprintf(command, sizeof(command), "gpart bootcode -p %s -i %s %s",
partcode_path(scheme, fstype), indexstr, pp->lg_geom->lg_name);
if (system(command) != 0) {
- sprintf(message, "Error installing partcode on partition %s",
+ snprintf(message, sizeof(message),
+ "Error installing partcode on partition %s",
pp->lg_name);
bsddialog_initconf(&conf);
conf.title = "Error";
@@ -659,7 +665,9 @@
if (strcmp(items[2].value, "/") == 0 && !is_fs_bootable(scheme,
items[0].value)) {
char message[512];
- sprintf(message, "This file system (%s) is not bootable "
+
+ snprintf(message, sizeof(message),
+ "This file system (%s) is not bootable "
"on this system. Are you sure you want to proceed?",
items[0].value);
conf.button.default_cancel = true;
@@ -1182,7 +1190,8 @@
if (expand_number(items[1].value, &bytes) != 0) {
char error[512];
- sprintf(error, "Invalid size: %s\n", strerror(errno));
+ snprintf(error, sizeof(error), "Invalid size: %s\n",
+ strerror(errno));
conf.title = "Error";
bsddialog_msgbox(&conf, error, 0, 0);
goto addpartform;
@@ -1234,7 +1243,9 @@
/* If this is the root partition, check that this scheme is bootable */
if (strcmp(items[2].value, "/") == 0 && !is_scheme_bootable(scheme)) {
char message[512];
- sprintf(message, "This partition scheme (%s) is not bootable "
+
+ snprintf(message, sizeof(message),
+ "This partition scheme (%s) is not bootable "
"on this platform. Are you sure you want to proceed?",
scheme);
conf.button.default_cancel = true;
@@ -1249,7 +1260,9 @@
if (strcmp(items[2].value, "/") == 0 && !is_fs_bootable(scheme,
items[0].value)) {
char message[512];
- sprintf(message, "This file system (%s) is not bootable "
+
+ snprintf(message, sizeof(message),
+ "This file system (%s) is not bootable "
"on this system. Are you sure you want to proceed?",
items[0].value);
conf.button.default_cancel = true;
diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c b/usr.sbin/bsdinstall/partedit/part_wizard.c
--- a/usr.sbin/bsdinstall/partedit/part_wizard.c
+++ b/usr.sbin/bsdinstall/partedit/part_wizard.c
@@ -277,7 +277,8 @@
char warning[512];
int subchoice;
- sprintf(warning, "The existing partition scheme on this "
+ snprintf(warning, sizeof(warning),
+ "The existing partition scheme on this "
"disk (%s) is not bootable on this platform. To install "
OSNAME ", it must be repartitioned. This will destroy all "
"data on the disk. Are you sure you want to proceed?",
@@ -367,7 +368,8 @@
HN_DECIMAL);
humanize_number(neededstr, 7, MIN_FREE_SPACE, "B", HN_AUTOSCALE,
HN_DECIMAL);
- sprintf(message, "There is not enough free space on %s to "
+ snprintf(message, sizeof(message),
+ "There is not enough free space on %s to "
"install " OSNAME " (%s free, %s required). Would you like "
"to choose another disk or to open the partition editor?",
disk, availablestr, neededstr);
diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c
--- a/usr.sbin/bsdinstall/partedit/partedit.c
+++ b/usr.sbin/bsdinstall/partedit/partedit.c
@@ -436,7 +436,8 @@
fstab_path = "/etc/fstab";
fstab = fopen(fstab_path, "w+");
if (fstab == NULL) {
- sprintf(message, "Cannot open fstab file %s for writing (%s)\n",
+ snprintf(message, sizeof(message),
+ "Cannot open fstab file %s for writing (%s)\n",
getenv("PATH_FSTAB"), strerror(errno));
conf.title = "Error";
bsddialog_msgbox(&conf, message, 0, 0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 12:40 AM (9 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31942274
Default Alt Text
D42240.id128881.diff (5 KB)
Attached To
Mode
D42240: bsdinstall partedit: Use snprintf instead of sprintf for error messages
Attached
Detach File
Event Timeline
Log In to Comment