Browse code

dispatcher: init attrs value when param not given to rpc add

- GH #2854

(cherry picked from commit 7894fb470e707622b077d565763c9cfb7c654da5)
(cherry picked from commit 55312a08806027850840cf5b1f69ec7469965730)

Daniel-Constantin Mierla authored on 16/09/2021 06:37:55
Showing 1 changed files
... ...
@@ -1799,7 +1799,7 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
1799 1799
 {
1800 1800
 	int group, flags, nparams;
1801 1801
 	str dest;
1802
-	str attrs;
1802
+	str attrs = STR_NULL;
1803 1803
 
1804 1804
 	flags = 0;
1805 1805
 
... ...
@@ -1807,7 +1807,7 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
1807 1807
 	if(nparams < 2) {
1808 1808
 		rpc->fault(ctx, 500, "Invalid Parameters");
1809 1809
 		return;
1810
-	} else if (nparams < 3) {
1810
+	} else if (nparams <= 3) {
1811 1811
 		attrs.s = 0;
1812 1812
 		attrs.len = 0;
1813 1813
 	}