From: Andre Noll Date: Sun, 31 Jul 2011 12:40:10 +0000 (+0200) Subject: afs: Fix long-standing bug in add command. X-Git-Tag: v0.4.8~24 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=b2d959ddd03c85403ee96b4a94dd505419e5b157;ds=sidebyside afs: Fix long-standing bug in add command. Before the add command handler adds a given audio file to the database it asks the afs process to check whether the file already exists. The afs process looks for rows in the audio file table with path and/or hash identical to the given file. If a match is found a pointer to the matching row is passed from afs to the command handler. The get_row_pointer_from_result() helper is then called by the command handler to extract the row pointer from the result returned by afs. However, this helper incorrectly dereferenced the pointer which caused the command handler to examine an address rather than the content of the address to tell whether the file already exists and whether path or content has changed. This could lead to changed/moved files being ignored as well as existing files being added again. This bug was introduced in commit 0a3b9b83, back in 2008. --- diff --git a/aft.c b/aft.c index a27e67ee..f4080233 100644 --- a/aft.c +++ b/aft.c @@ -1823,7 +1823,7 @@ static void hash_sister_callback(int fd, const struct osl_object *query) static int get_row_pointer_from_result(struct osl_object *result, void *private) { struct osl_row **row = private; - *row = result->data; + *row = *(struct osl_row **)(result->data); return 1; }