Page MenuHomeFreeBSD

tzsetup
ClosedPublic

Authored by bapt on Mon, Nov 22, 10:37 AM.

Details

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bapt requested review of this revision.Mon, Nov 22, 10:37 AM

catchup with bsddialog_initconf

I changed the api, sorry, you should change
terminalwidth() -> bsddialog_terminalwidth();
terminalwidth(); -> bsddialog_terminalwidth();
if (listitems[i].on == 'X') -> if (listitems[i].on == true)
Now warnings are fixed.

Important: "Bus error (core dump)", to reproduce:
<NO> -> Europe -> Italy -> <No> -> <Cancel>

I am investigating

usr.sbin/tzsetup/tzsetup.c
155

bsddialog_terminalheight())

155–156

bsddialog_terminalheight())

176

bsddialog_terminalwidth();

176–177

bsddialog_terminalwidth())

184

if (listitems[i].on == true)

alfix86_gmail.com added inline comments.
usr.sbin/tzsetup/tzsetup.c
140–142

This fix the overflow:
listitems = calloc(item_no + 1, sizeof(struct bsddialog_menuitem));

149

To be sure, I would add also:

listitems[i].depth = 0;
listitems[i].bottomdesc = "";
listitems[i].on = false;

This revision is now accepted and ready to land.Mon, Nov 22, 11:28 PM

Important:
Please, for now use

terminalheight() - 2

and

terminalwidth() -3

to fix a silent error (unpleasant consequence: the enter key has not effect with long menus)

I am going to write documented functions:
getwidget_height()/width() (they already exist but as internal utils).
Sorry for the fix after the "Accept"

usr.sbin/tzsetup/tzsetup.c
155

fix
bsddialog_terminalheight() -2;

155–156

fix
if (height > terminalheight() -2)

176

width = terminalwidth() -3;

176–177

if (width > terminalwidth() -3)

This revision was automatically updated to reflect the committed changes.