owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
1.99k stars 227 forks source link

Fix potential Null pointer dereference in mpd.c #1746

Closed icy17 closed 1 month ago

ejurgensen commented 1 month ago

I'm not sure checking for OOM is worth it in all cases, so I won't merge this

icy17 commented 1 month ago

I'm not sure checking for OOM is worth it in all cases, so I won't merge this

But if OOM, the NULL parameter for bufferevent_setcb and bufferevent_free will lead to a null pointer dereference. Don't check making the crash hard to trace.

ejurgensen commented 1 month ago

It's a bit of a long explenation, and there are differing viewpoints on the subject. The gist of it is that checking for null is not really a reliable solution. If you google Linux memory allocation you can probably find some discussions.

icy17 commented 1 month ago

Thanks for the explanation, I get it.