aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-24 17:40:41 +0100
committerMax Kellermann <max@duempel.org>2008-12-24 17:40:41 +0100
commita94e59ca2192a9ba80d5ab1919dc25918ce4163c (patch)
treedc185b6849ee5c093630d27501a179748591033c /src
parent7f98ba24c7ffb026544a0c400e9d8a34ed955782 (diff)
downloadmpd-a94e59ca2192a9ba80d5ab1919dc25918ce4163c.tar.gz
mpd-a94e59ca2192a9ba80d5ab1919dc25918ce4163c.tar.xz
mpd-a94e59ca2192a9ba80d5ab1919dc25918ce4163c.zip
stored_playlist: fix integer overflow in length estimation
With a large maximum playlist length, the integer multiplication "playlist_max_length * MPD_PATH_MAX" may overflow. Change that to a division. This was not a dangerous bug, since it was only used for a quick estimate.
Diffstat (limited to 'src')
-rw-r--r--src/stored_playlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stored_playlist.c b/src/stored_playlist.c
index 5c2d46709..78977bf69 100644
--- a/src/stored_playlist.c
+++ b/src/stored_playlist.c
@@ -338,7 +338,7 @@ spl_append_song(const char *utf8path, struct song *song)
return PLAYLIST_RESULT_ERRNO;
}
- if (st.st_size >= ((MPD_PATH_MAX+1) * (off_t)playlist_max_length)) {
+ if (st.st_size / (MPD_PATH_MAX + 1) >= (off_t)playlist_max_length) {
while (fclose(file) != 0 && errno == EINTR);
return PLAYLIST_RESULT_TOO_LARGE;
}