Fix a type promotion bug discivered and analyzed by Alan Modra
[oweals/busybox.git] / archival / libunarchive / unzip.c
index 9568c2870591f0fa97169d93ba52f52df3aabb0d..40b8af427d2f3761226df63f03c2512c52e979cb 100644 (file)
@@ -65,10 +65,6 @@ static char *license_msg[] = {
 #include <signal.h>
 #include <stdlib.h>
 #include "libbb.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#define bb_need_name_too_long
-#include "../messages.c"
 
 FILE *in_file, *out_file;
 
@@ -1001,7 +997,7 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
        fread(buf, 1, 8, in_file);
 
        /* Validate decompression - crc */
-       if (((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
+       if ((unsigned int)((buf[0] | (buf[1] << 8)) |((buf[2] | (buf[3] << 8)) << 16)) != (crc ^ 0xffffffffL)) {
                error_msg("invalid compressed data--crc error");
        }
        /* Validate decompression - size */