Browse code

modules/ndb_redis: b/f restore correctly last char in argument strings.

Vicente Hernando authored on 08/04/2013 09:47:51
Showing 1 changed files
... ...
@@ -248,12 +248,12 @@ static int w_redis_cmd5(struct sip_msg* msg, char* ssrv, char* scmd,
248 248
 	arg1.s[arg1.len] = '\0';
249 249
 	arg2.s[arg2.len] = '\0';
250 250
 	if(redisc_exec(&s[0], &s[2], &s[1], arg1.s, arg2.s)<0) {
251
-		c1 = arg1.s[arg1.len];
252
-		c2 = arg2.s[arg2.len];
251
+		arg1.s[arg1.len] = c1;
252
+		arg2.s[arg2.len] = c2;
253 253
 		return -1;
254 254
 	}
255
-	c1 = arg1.s[arg1.len];
256
-	c2 = arg2.s[arg2.len];
255
+	arg1.s[arg1.len] = c1;
256
+	arg2.s[arg2.len] = c2;
257 257
 	return 1;
258 258
 }
259 259
 
... ...
@@ -305,14 +305,14 @@ static int w_redis_cmd6(struct sip_msg* msg, char* ssrv, char* scmd,
305 305
 	arg2.s[arg2.len] = '\0';
306 306
 	arg3.s[arg3.len] = '\0';
307 307
 	if(redisc_exec(&s[0], &s[2], &s[1], arg1.s, arg2.s, arg3.s)<0) {
308
-		c1 = arg1.s[arg1.len];
309
-		c2 = arg2.s[arg2.len];
310
-		c3 = arg3.s[arg3.len];
308
+		arg1.s[arg1.len] = c1;
309
+		arg2.s[arg2.len] = c2;
310
+		arg3.s[arg3.len] = c3;
311 311
 		return -1;
312 312
 	}
313
-	c1 = arg1.s[arg1.len];
314
-	c2 = arg2.s[arg2.len];
315
-	c3 = arg3.s[arg3.len];
313
+	arg1.s[arg1.len] = c1;
314
+	arg2.s[arg2.len] = c2;
315
+	arg3.s[arg3.len] = c3;
316 316
 	return 1;
317 317
 }
318 318