Browse code

bb11992: cleaning up some variable initialization.

Micah Snyder authored on 2017/12/20 22:27:21
Showing 6 changed files
... ...
@@ -1389,6 +1389,8 @@ static int cabd_sys_read_block(struct mspack_system *sys,
1389 1389
   unsigned int cksum;
1390 1390
   unsigned int len;
1391 1391
 
1392
+  (void) ignore_cksum;
1393
+
1392 1394
   /* reset the input block pointer and end of block pointer */
1393 1395
   d->i_ptr = d->i_end = &d->input[0];
1394 1396
 
... ...
@@ -451,7 +451,7 @@ int cli_scanmschm(cli_ctx *ctx)
451 451
 	struct mschm_decompressor *mschm_d;
452 452
 	struct mschmd_header *mschm_h;
453 453
 	struct mschmd_file *mschm_f;
454
-	int ret;
454
+	int ret = CL_CLEAN; // Default CLEAN in case CHM contains no files.
455 455
 	int files;
456 456
 	int virus_num = 0;
457 457
 	struct mspack_name mspack_fmap = {
... ...
@@ -546,6 +546,4 @@ out_dest:
546 546
 	if (virus_num)
547 547
 		return CL_VIRUS;
548 548
 	return ret;
549
-
550
-	return 0;
551 549
 }
... ...
@@ -1066,7 +1066,7 @@ inline static int ac_findmatch_special(const unsigned char *buffer, uint32_t off
1066 1066
 static int ac_backward_match_branch(const unsigned char *buffer, uint32_t bp, uint32_t offset, uint32_t fileoffset, uint32_t length,
1067 1067
                                     const struct cli_ac_patt *pattern, uint32_t pp, uint16_t specialcnt, uint32_t *start, uint32_t *end)
1068 1068
 {
1069
-    int match;
1069
+    int match = 0;
1070 1070
     uint16_t wc, i;
1071 1071
     uint32_t filestart;
1072 1072
 
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2015 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
2
+ *  Copyright (C) 2015, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3 3
  *  Copyright (C) 2007-2008 Sourcefire, Inc.
4 4
  *
5 5
  *  Authors: Tomasz Kojm
... ...
@@ -98,7 +98,8 @@ int cli_msexpand(cli_ctx *ctx, int ofd)
98 98
 	const struct msexp_hdr *hdr;
99 99
 	uint8_t i, mask, bits;
100 100
 	unsigned char buff[B_SIZE], wbuff[RW_SIZE];
101
-	const unsigned char *rbuff;
101
+	const unsigned char *rbuff = NULL; 	// rbuff will be set to a real address by READBYTES
102
+										// in the first iteration of the loop.
102 103
 	unsigned int j = B_SIZE - 16, k, l, r = 0, w = 0, rbytes = 0, wbytes = 0;
103 104
 	fmap_t *map = *ctx->fmap;
104 105
 	off_t cur_off = sizeof(*hdr);
... ...
@@ -1566,7 +1566,7 @@ static const int gkernsz = (sizeof(gaussk) / sizeof(gaussk[0]));
1566 1566
             case 8:
1567 1567
             {
1568 1568
                 unsigned int have = 0;
1569
-                unsigned char c;
1569
+                unsigned char c = 0; // will be set in first loop
1570 1570
                 for (x = 0; x < width; x++)
1571 1571
                 {
1572 1572
                     if (!have)
... ...
@@ -1645,7 +1645,7 @@ static const int gkernsz = (sizeof(gaussk) / sizeof(gaussk[0]));
1645 1645
             {
1646 1646
                 unsigned int x_off = y * andlinesz;
1647 1647
                 unsigned int have = 0;
1648
-                unsigned char c;
1648
+                unsigned char c = 0; // will be set in first loop
1649 1649
                 for (x = 0; x < width; x++)
1650 1650
                 {
1651 1651
                     if (!have)
... ...
@@ -940,14 +940,14 @@ void ppm_cleanup(ppm_data_t *ppm_data)
940 940
 
941 941
 int ppm_decode_init(ppm_data_t *ppm_data, int fd, unpack_data_t *unpack_data, int *EscChar)
942 942
 {
943
-	int max_order, Reset, MaxMB;
943
+	int max_order = 0, Reset = 0, MaxMB = 0;
944 944
 	
945
-	max_order = rar_get_char(fd, unpack_data);
945
+	max_order = (int) rar_get_char(fd, unpack_data);
946 946
 	rar_dbgmsg("ppm_decode_init max_order=%d\n", max_order);
947 947
 	Reset = (max_order & 0x20) ? 1 : 0;
948 948
 	rar_dbgmsg("ppm_decode_init Reset=%d\n", Reset);
949 949
 	if (Reset) {
950
-		MaxMB = rar_get_char(fd, unpack_data);
950
+		MaxMB = (int) rar_get_char(fd, unpack_data);
951 951
 		rar_dbgmsg("ppm_decode_init MaxMB=%d\n", MaxMB);
952 952
 	} else {
953 953
 		if (sub_allocator_get_allocated_memory(&ppm_data->sub_alloc) == 0) {