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.
This commit is contained in:
parent
7f98ba24c7
commit
a94e59ca21
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user