1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix sysmerge(8) out of bounds accesses and error messages.

This commit is contained in:
Jonas 'Sortie' Termansen 2016-08-22 18:07:01 +02:00
parent f28fc4ac39
commit c195784736

View file

@ -120,21 +120,21 @@ int main(int argc, char* argv[])
{
source = NULL;
if ( 1 < argc )
err(2, "Unexpected extra operand `%s'", argv[2]);
errx(2, "Unexpected extra operand `%s'", argv[1]);
}
else if ( booting )
{
source = "/sysmerge";
if ( 1 < argc )
err(2, "Unexpected extra operand `%s'", argv[2]);
errx(2, "Unexpected extra operand `%s'", argv[1]);
}
else
{
if ( argc < 2 )
err(2, "No source operand was given");
errx(2, "No source operand was given");
source = argv[1];
if ( 2 < argc )
err(2, "Unexpected extra operand `%s'", argv[2]);
errx(2, "Unexpected extra operand `%s'", argv[2]);
}
if ( booting )
@ -216,11 +216,11 @@ int main(int argc, char* argv[])
{
printf(" - Scheduling upgrade on next boot...\n");
execute((const char*[]) { "cp", "/boot/sortix.bin",
"/boot/sortix.bin.sysmerge.orig" }, "_e");
"/boot/sortix.bin.sysmerge.orig", NULL }, "_e");
execute((const char*[]) { "cp", "/boot/sortix.initrd",
"/boot/sortix.initrd.sysmerge.orig" }, "_e");
"/boot/sortix.initrd.sysmerge.orig", NULL }, "_e");
execute((const char*[]) { "cp", "/sysmerge/boot/sortix.bin",
"/boot/sortix.bin" }, "_e");
"/boot/sortix.bin", NULL }, "_e");
execute((const char*[]) { "/sysmerge/sbin/update-initrd", NULL }, "_e");
printf("The system will be upgraded to %s on the next boot.\n",