[Bug 273220] "scriptedpart DEFAULT" will segfault with unformatted disks

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 18 Aug 2023 23:45:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273220

            Bug ID: 273220
           Summary: "scriptedpart DEFAULT" will segfault with unformatted
                    disks
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: lars@oddbit.com

Called as `bsdinstall scriptedpart DEFAULT`, partedit will arrive at line
204...

    return (part_config(disk, scheme, partconfig));

...with `disk`, `scheme`, and `partconfig` all set to `NULL`. These are passed
to `part_config()`, which on line 79 calls:

    if (provider_for_name(&mesh, disk) == NULL) {

With `disk` == `NULL`. In `provider_for_name()`, on line 52, we have:

    if (strcmp(pp->lg_name, name) == 0)

Here, `name` is `NULL` (it receives the value of `disk` from `part_config()`,
and this triggers a segfault.

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