Browse code

dispatcher: safety checks for str fields

Daniel-Constantin Mierla authored on 11/01/2022 07:20:30
Showing 1 changed files
... ...
@@ -1192,7 +1192,7 @@ unsigned int ds_get_hash(str *x, str *y)
1192 1192
 	if(!x && !y)
1193 1193
 		return 0;
1194 1194
 	h = 0;
1195
-	if(x) {
1195
+	if(x && x->s) {
1196 1196
 		p = x->s;
1197 1197
 		if(x->len >= 4) {
1198 1198
 			for(; p <= (x->s + x->len - 4); p += 4) {
... ...
@@ -1207,7 +1207,7 @@ unsigned int ds_get_hash(str *x, str *y)
1207 1207
 		}
1208 1208
 		h += v ^ (v >> 3);
1209 1209
 	}
1210
-	if(y) {
1210
+	if(y && y->s) {
1211 1211
 		p = y->s;
1212 1212
 		if(y->len >= 4) {
1213 1213
 			for(; p <= (y->s + y->len - 4); p += 4) {