[Bug 273218] scriptedpart will segfault if not provided with any arguments

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 18 Aug 2023 22:43:20 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273218

            Bug ID: 273218
           Summary: scriptedpart will segfault if not provided with any
                    arguments
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: lars@oddbit.com

Running `bsdinstall scriptedpart` runs the `scripted_editor` function in the
`partedit` sources, which starts like this:

    fp = open_memstream(&input, &len);
    fputs(argv[1], fp);
    for (i = 2; i < argc; i++) {
      fprintf(fp, " %s", argv[i]);
    }
    fclose(fp);

That `puts(argv[1], fp)` will segfault if there are no arguments.

`bsdinstall scriptedpart` should exit with an error message instead of
segfaulting.

-- 
You are receiving this mail because:
You are the assignee for the bug.