[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#778773: [PATCH] Likely fix for crash



It seems to me inspecting the code of parted_server.c that:

                deactivate_exception_handler();
                fstype = ped_file_system_probe(&(part->geom));
                if (fstype == NULL) {
                        oprintf("none\n");
                } else {
                        if (0 == strncmp(part->fs_type->name, "linux-swap", 10))
                                oprintf("linux-swap\n");
                        else
                                oprintf("%s\n", fstype->name);
                }
                free(id);

should instead be:

                deactivate_exception_handler();
                fstype = ped_file_system_probe(&(part->geom));
                if (fstype == NULL) {
                        oprintf("none\n");
                } else {
                        if (0 == strncmp(fstype->name, "linux-swap", 10))  <--- changed
                                oprintf("linux-swap\n");
                        else
                                oprintf("%s\n", fstype->name);
                }
                free(id);

After all I see no reason why part->fs_type->name should even be
initialized at that point, while fstype->name was just initialized and
is used in the else.  That would explain the segfault.

I suspect a cut and paste error from elsewhere in the file.  After all line
1066 has the same strncmp, except there it is correct to use
part->fs_type->name.

-- 
Len Sorensen


Reply to: