Browse code

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

- GH #2854

Daniel-Constantin Mierla authored on 16/09/2021 06:37:55
Showing 1 changed files
... ...
@@ -1854,7 +1854,7 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
1854 1854
 {
1855 1855
 	int group, flags, nparams;
1856 1856
 	str dest;
1857
-	str attrs;
1857
+	str attrs = STR_NULL;
1858 1858
 
1859 1859
 	flags = 0;
1860 1860
 
... ...
@@ -1862,7 +1862,7 @@ static void dispatcher_rpc_add(rpc_t *rpc, void *ctx)
1862 1862
 	if(nparams < 2) {
1863 1863
 		rpc->fault(ctx, 500, "Invalid Parameters");
1864 1864
 		return;
1865
-	} else if (nparams < 3) {
1865
+	} else if (nparams <= 3) {
1866 1866
 		attrs.s = 0;
1867 1867
 		attrs.len = 0;
1868 1868
 	}