From 29df70366c807a671611720ad0419c6da1ac0e41 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sat, 26 Jan 2008 20:20:59 +0000
Subject: storedPlaylist: prevent potential DoS from stored playlist commands

While mpd has always protected against the infinite expansion of
the main playlist by limiting its size in memory, however the
new storedPlaylist code has never checked for this limit.

Malicious (or clumsy) users could repeatedly append songs to
stored playlists, causing files to grow increasingly large
on disk.  Attempting to load extremely large files into memory
will require mpd to slurp that all into memory, and ultimately
the file would be unusable by mpd because of the configurable
playlist size limit.

Now we limit stored playlists to the max_playlist_length
configuration variable set by the user (default is 16384).  We
will refuse to append to playlist files if they hit that limit;
and also refuse to load more than the specified amount of songs
into memory.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7154 09075e82-0dd4-0310-85a5-a0d7c8717e4f
---
 src/playlist.h | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src/playlist.h')

diff --git a/src/playlist.h b/src/playlist.h
index 2e5ccf9ab..732ea814e 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -45,6 +45,8 @@ typedef struct _Playlist {
 
 extern int playlist_saveAbsolutePaths;
 
+extern int playlist_max_length;
+
 void initPlaylist(void);
 
 void finishPlaylist(void);
-- 
cgit v1.2.3