Browse code

fix possible NULL dereference (bb#611)

git-svn: trunk@3187

Tomasz Kojm authored on 2007/08/22 05:37:39
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Aug 21 21:42:14 CEST 2007 (tk)
2
+----------------------------------
3
+  * libclamav/rtf.c: fix possible NULL dereference (bb#611)
4
+
1 5
 Tue Aug 21 21:39:06 CEST 2007 (tk)
2 6
 ----------------------------------
3 7
   * libclamav/ole2_extract.c: properly initialise hdr.max_block_no (bb#603)
... ...
@@ -606,7 +606,9 @@ int cli_scanrtf(int desc, cli_ctx *ctx)
606 606
 											 return ret;
607 607
 										}
608 608
 									if(( ret = state.cb_process(&state, ptr, use) )) {
609
-										state.cb_end(&state,ctx);
609
+										if(state.cb_end) {
610
+											state.cb_end(&state,ctx);
611
+										}
610 612
 										SCAN_CLEANUP;
611 613
 										return ret;
612 614
 									}
... ...
@@ -677,6 +679,7 @@ int cli_scanrtf(int desc, cli_ctx *ctx)
677 677
 						if(action != -1) {
678 678
 							if(state.cb_data && state.cb_end) {/* premature end of previous block */
679 679
 								state.cb_end(&state,ctx);
680
+								state.cb_begin = NULL;
680 681
 								state.cb_end = NULL;
681 682
 								state.cb_data = NULL;
682 683
 							}