... | ... |
@@ -234,6 +234,13 @@ int udp_rcv_loop() |
234 | 234 |
len--; |
235 | 235 |
} |
236 | 236 |
#endif |
237 |
+#ifdef DBG_MSG_QA |
|
238 |
+ if (!dbg_msg_qa(buf, len)) { |
|
239 |
+ LOG(L_WARN, "WARNING: an incoming message didn't pass test, drop it: %.*s\n", |
|
240 |
+ len, buf ); |
|
241 |
+ continue; |
|
242 |
+ } |
|
243 |
+#endif |
|
237 | 244 |
|
238 | 245 |
/* receive_msg must free buf too!*/ |
239 | 246 |
receive_msg(buf, len, from); |
... | ... |
@@ -259,7 +266,7 @@ error: |
259 | 266 |
in generated messages; this debugging option aborts if |
260 | 267 |
any such message is sighted |
261 | 268 |
*/ |
262 |
-void dbg_msg_qa(char *buf, int len) |
|
269 |
+int dbg_msg_qa(char *buf, int len) |
|
263 | 270 |
{ |
264 | 271 |
#define _DBG_WS_LEN 3 |
265 | 272 |
#define _DBG_WS " " |
... | ... |
@@ -273,7 +280,7 @@ void dbg_msg_qa(char *buf, int len) |
273 | 280 |
/* is there a zero character inthere ? */ |
274 | 281 |
if (memchr(buf, 0, len)) { |
275 | 282 |
LOG(L_CRIT, "BUG: message being sent with 0 in it\n"); |
276 |
- abort(); |
|
283 |
+ return 0; |
|
277 | 284 |
} |
278 | 285 |
|
279 | 286 |
my_len=len; |
... | ... |
@@ -288,7 +295,7 @@ void dbg_msg_qa(char *buf, int len) |
288 | 295 |
if (space_cnt==4) { |
289 | 296 |
LOG(L_CRIT, "BUG(propably): DBG_MSG_QA: " |
290 | 297 |
"too many spaces\n"); |
291 |
- abort(); |
|
298 |
+ return 0; |
|
292 | 299 |
} |
293 | 300 |
} else space_cnt=0; |
294 | 301 |
state=QA_SPACE; |
... | ... |
@@ -314,7 +321,7 @@ void dbg_msg_qa(char *buf, int len) |
314 | 321 |
|
315 | 322 |
|
316 | 323 |
qa_passed: |
317 |
- return; |
|
324 |
+ return 1; |
|
318 | 325 |
} |
319 | 326 |
|
320 | 327 |
#endif |
... | ... |
@@ -328,7 +335,10 @@ int udp_send(struct socket_info *source, char *buf, unsigned len, |
328 | 335 |
|
329 | 336 |
#ifdef DBG_MSG_QA |
330 | 337 |
/* aborts on error, does nothing otherwise */ |
331 |
- dbg_msg_qa( buf, len ); |
|
338 |
+ if (!dbg_msg_qa( buf, len )) { |
|
339 |
+ LOG(L_ERR, "ERROR: udp_send: dbg_msg_qa failed\n"); |
|
340 |
+ abort(); |
|
341 |
+ } |
|
332 | 342 |
#endif |
333 | 343 |
|
334 | 344 |
|