1
0
Fork 0
forked from len0rd/rockbox

[coverity] playlist.c format_track_path() guard NULL pointers

Change-Id: If029477ef9f38ee57b3afb7901d7429319675cc5
This commit is contained in:
William Wilgus 2024-06-07 00:38:20 -04:00
parent 4829c2c894
commit 3b9d804bdf

View file

@ -555,6 +555,12 @@ static ssize_t format_track_path(char *dest, char *src, int buf_length,
const char *dir, size_t dlen)
{
/* Look for the end of the string (includes NULL) */
if (!src || !dest || !dir)
{
DEBUGF("%s() bad pointer", __func__);
return -2; /* bad pointers */
}
size_t len = strcspn(src, "\r\n");;
/* Now work back killing white space */
while (len > 0)