Project

General

Profile

Bug #9293

bootadm: empty line between boot entries in menu.lst cause bootadm list-menu to segfault

Added by Gergő Mihály Doma over 1 year ago.

Status:
New
Priority:
Normal
Category:
cmd - userland programs
Start date:
2018-03-17
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

Description

The Illumos Project     SunOS 5.11      illumos-68f58420d1      March 2018
root@openindiana:~# bootadm
bootadm: a command option must be specified
USAGE:
        bootadm update-archive [-vn] [-R altroot [-p platform]]
        bootadm list-archive [-R altroot [-p platform]]
        bootadm install-bootloader [-Mfv] [-R altroot] [-P pool]
        bootadm set-menu [-R altroot] key=value
        bootadm list-menu [-R altroot]
root@openindiana:~# bootadm list-menu
Segmentation Fault (core készült)
root@openindiana:~# cd /
root@openindiana:/# mdb core
Loading modules: [ libc.so.1 libumem.so.1 libtopo.so.1 libavl.so.1 libuutil.so.1 libnvpair.so.1 ld.so.1 ]
> $C
08046c88 libc.so.1`strcmp+0xe7(0, 80785cd, 809be70, 805bbbf)
080470d8 menu_read+0xa8(8047100, 80479a0, 400, 804710c)
08047db8 bam_loader_menu+0x4f4(80761fc, 0, 0, 0)
08047de8 main+0x137(8047dec, fef5f2c8, 8047e28, 80559c8, 2, 8047e50)
08047e28 _start_crt+0x97(2, 8047e50, fefd1c00, 0, 0, 0)
08047e44 _start+0x1a(2, 8047f0c, 8047f14, 0, 8047f1e, 8047f2f)
> $Q
root@openindiana:~# cat /rpool/boot/menu.lst 
title openindiana
bootfs rpool/ROOT/openindiana

title nightly-2018-02-27
bootfs rpool/ROOT/nightly-2018-02-27
title openindiana-1
bootfs rpool/ROOT/openindiana-1
root@openindiana:~# 

From the strtok manual:

...
If no such byte is found, then there are no tokens in
the string pointed to by s1 and strtok() returns a null pointer.
...

Need to check for that NULL pointers returned from strtok() calls in menu_read() .

Also available in: Atom PDF