From: Andre Noll Date: Sat, 29 Aug 2015 13:10:25 +0000 (+0200) Subject: setatt: Do not abort if no pattern is given. X-Git-Tag: v0.5.5~8 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=8652682aa38c95972e317f84a520d5e2fcabf0c8;hp=074b80bb23b8fa610464bd98dc4bc7dd2babc88a setatt: Do not abort if no pattern is given. It is an error if no pattern is given to the setatt command. For example, setatt foo+ bar- should result in a syntax error because no file name pattern is given. The code in aft.c contains an assertion to detect this type of error, but the afs proccess terminates if the condition of the assert statement is not fulfilled: para_server (afs): aft.c:2557: com_setatt_callback: Assertion `p < (char *)query->data + query->size' failed. This patch turns the assertion into a normal check which merely causes the command to fail if no pattern was given. The bug was introduced two years ago in commit 73299ebf (com_setatt(): Allow to specify a file name pattern). --- diff --git a/aft.c b/aft.c index 96f65e99..c4558f20 100644 --- a/aft.c +++ b/aft.c @@ -2561,7 +2561,8 @@ static void com_setatt_callback(int fd, const struct osl_object *query) if (!cad.add_mask && !cad.del_mask) goto out; pmd.patterns.data = p; - assert(p < (char *)query->data + query->size); + if (p >= (char *)query->data + query->size) + goto out; pmd.patterns.size = (char *)query->data + query->size - p; ret = for_each_matching_row(&pmd); if (ret < 0)