aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-09 19:17:33 +0200
committerEric Wong <normalperson@yhbt.net>2008-10-11 19:21:51 -0700
commit0775237e40087ee328888eb2b16953dc0cb332e0 (patch)
tree83bc5252813b9eb6b75b5ac6c224f73babaaccd4
parent0d4cc41ae07ca3f2e079fced38d9bd244c787df8 (diff)
downloadmpd-0775237e40087ee328888eb2b16953dc0cb332e0.tar.gz
mpd-0775237e40087ee328888eb2b16953dc0cb332e0.tar.xz
mpd-0775237e40087ee328888eb2b16953dc0cb332e0.zip
update: fixed stack corruption due to pthread_join() call
pthread_join() expects a "pointer to a pointer" parameter, but it got a "pointer to an enum". On AMD64, an enum is smaller than a pointer, leading to a buffer overflow.
-rw-r--r--src/update.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c
index 4498449bd..34ec1ba77 100644
--- a/src/update.c
+++ b/src/update.c
@@ -433,6 +433,7 @@ int directory_update_init(char *path)
void reap_update_task(void)
{
+ void *thread_return;
enum update_return ret;
assert(pthread_equal(pthread_self(), main_task));
@@ -449,8 +450,9 @@ void reap_update_task(void)
if (progress != UPDATE_PROGRESS_DONE)
return;
- if (pthread_join(update_thr, (void **)&ret))
+ if (pthread_join(update_thr, &thread_return))
FATAL("error joining update thread: %s\n", strerror(errno));
+ ret = (enum update_return)(size_t)thread_return;
if (ret == UPDATE_RETURN_UPDATED)
playlistVersionChange();