1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Fix crash when using NetBSD curses implementation

Thanks to @alarixnia fot the patch and bugreport.

```
Forwarding a bug reported using the NetBSD bug tracker ("Profanity crashes at login"): http://gnats.netbsd.org/57050

The code in question here handles messages by people not in the user's contact list, and what is probably happening is that the XMPP server is sending such a message before profanity has set up its window layout.

Setting roster.unsubscribed=false indeed makes profanity start without crashing, and the attached patch bails out early in the problematic code path if layout->subwin is NULL (Adrian verified for me that either of the two makes profanity work for him again). But I am not familiar enough with the profanity code to say if this has any issues.

Profanity compiled with ncurses doesn't crash because ncurses's wattron() has a guard against the user passing null pointers, but the X/Open curses library standard doesn't have this guarantee and there's no guard in the NetBSD curses implementation.
```

Fix https://github.com/profanity-im/profanity/issues/1769
This commit is contained in:
Michael Vetter 2023-07-12 13:58:03 +02:00
parent 91c2c5f374
commit 62e98dee74

View File

@ -98,9 +98,11 @@ rosterwin_roster(void)
ProfLayoutSplit* layout = (ProfLayoutSplit*)console->layout;
assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);
if (layout->subwin != NULL) {
werase(layout->subwin);
if (layout->subwin == NULL) {
return;
}
werase(layout->subwin);
auto_gchar gchar* roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) {