dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.56k stars 340 forks source link

NULL pointers passed to *printf #1305

Closed Strahinja closed 6 months ago

Strahinja commented 7 months ago

Issue description

Under OpenBSD, a bunch of lines like

  8 Mar  4 15:45:23 host dunst: vfprintf %s NULL in "[%16s:%04d] summary %s"
  7 Mar  4 15:45:23 host dunst: vfprintf %s NULL in "[%16s:%04d] appname %s"
  6 Mar  4 15:45:23 host dunst: vfprintf %s NULL in "[%16s:%04d] script %s"
  5 Mar  4 15:45:23 host dunst: vfprintf %s NULL in "[%16s:%04d] frame %s"

are added to /var/log/messages. These appear whenever some program passes NULL to the *printf family of functions in OpenBSD. It seems that those come from settings.c, where the struct members are passed to LOG_D without checking if they are NULL.

Installation info

Minimal dunstrc ```ini # Dunstrc here ```
bynect commented 7 months ago

We rely heavily on printing null strings with the assumption that they will be printed as "(null)". Is there no way to turn off those logs?

Strahinja commented 7 months ago

The messages are written by syslogd(8), which can only filter them according to log facility and level. Still, I find it shocking that passing NULLs seems to be a practice rather than an oversight.

bynect commented 7 months ago

It is more of an historical artifact. Anyway I checked and it seems ub, so we may want to change that in the near future

bynect commented 6 months ago

@Strahinja if you find that there are some other nulls I forgot to handle feel free to reopen this 👍🏻