diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-12-15 20:05:57 +0100 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-12-15 20:06:36 +0100 |
commit | fac7d0d211ab56d8a1357d7837dae789aa3cbf64 (patch) | |
tree | 98cd956c8d53535366792fce6c518745387ff5de /src | |
parent | 6a62ae4231c2ce10b6623e32198f40f0a2a8e777 (diff) | |
parent | e51da0e0fb8c55cb874d87dafc7eec93bee6beb3 (diff) | |
download | pianobar-fac7d0d211ab56d8a1357d7837dae789aa3cbf64.tar.gz pianobar-fac7d0d211ab56d8a1357d7837dae789aa3cbf64.tar.bz2 pianobar-fac7d0d211ab56d8a1357d7837dae789aa3cbf64.zip |
Merge branch 'fuzzing'
Fixes NULL-pointer dereferences and invalid memory reads.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 55 |
1 files changed, 30 insertions, 25 deletions
@@ -258,31 +258,36 @@ int main (int argc, char **argv) { BarUiPrintSong (playlist, curStation->isQuickMix ? PianoFindStationById (ph.stations, playlist->stationId) : NULL); - /* setup artist and song name for scrobbling (playlist - * may be NULL later) */ - WardrobeSongInit (&scrobbleSong); - scrobbleSong.artist = strdup (playlist->artist); - scrobbleSong.title = strdup (playlist->title); - scrobbleSong.album = strdup (playlist->album); - scrobbleSong.started = time (NULL); - - /* setup player */ - memset (&player, 0, sizeof (player)); - - WaitressInit (&player.waith); - WaitressSetUrl (&player.waith, playlist->audioUrl); - - player.gain = playlist->fileGain; - player.audioFormat = playlist->audioFormat; - - /* throw event */ - BarUiStartEventCmd (&settings, "songstart", curStation, - playlist, PIANO_RET_OK); - - /* start player */ - pthread_create (&playerThread, NULL, BarPlayerThread, - &player); - } + + if (playlist->audioUrl == NULL) { + BarUiMsg (MSG_ERR, "Invalid song url.\n"); + } else { + /* setup artist and song name for scrobbling (playlist + * may be NULL later) */ + WardrobeSongInit (&scrobbleSong); + scrobbleSong.artist = strdup (playlist->artist); + scrobbleSong.title = strdup (playlist->title); + scrobbleSong.album = strdup (playlist->album); + scrobbleSong.started = time (NULL); + + /* setup player */ + memset (&player, 0, sizeof (player)); + + WaitressInit (&player.waith); + WaitressSetUrl (&player.waith, playlist->audioUrl); + + player.gain = playlist->fileGain; + player.audioFormat = playlist->audioFormat; + + /* throw event */ + BarUiStartEventCmd (&settings, "songstart", curStation, + playlist, PIANO_RET_OK); + + /* start player */ + pthread_create (&playerThread, NULL, BarPlayerThread, + &player); + } /* end if audioUrl == NULL */ + } /* end if playlist != NULL */ } /* end if curStation != NULL */ } |