From 8652682aa38c95972e317f84a520d5e2fcabf0c8 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 29 Aug 2015 15:10:25 +0200 Subject: [PATCH 1/1] 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). --- aft.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.39.2