summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@lavabit.com>2009-12-15 20:05:57 +0100
committerLars-Dominik Braun <PromyLOPh@lavabit.com>2009-12-15 20:06:36 +0100
commitfac7d0d211ab56d8a1357d7837dae789aa3cbf64 (patch)
tree98cd956c8d53535366792fce6c518745387ff5de /src
parent6a62ae4231c2ce10b6623e32198f40f0a2a8e777 (diff)
parente51da0e0fb8c55cb874d87dafc7eec93bee6beb3 (diff)
downloadpianobar-windows-fac7d0d211ab56d8a1357d7837dae789aa3cbf64.tar.gz
pianobar-windows-fac7d0d211ab56d8a1357d7837dae789aa3cbf64.tar.bz2
pianobar-windows-fac7d0d211ab56d8a1357d7837dae789aa3cbf64.zip
Merge branch 'fuzzing'
Fixes NULL-pointer dereferences and invalid memory reads.
Diffstat (limited to 'src')
-rw-r--r--src/main.c55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/main.c b/src/main.c
index fc6fc76..bfe4965 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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 */
}