zip-3.0-45.fc44

List of Findings

Error: COMPILER_WARNING (CWE-252): [#def1]
zip30/fileio.c: scope_hint: In function ‘ask_for_split_read_path’
zip30/fileio.c:2120:5: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
# 2120 |     fgets(buf, SPLIT_MAXPATH, stdin);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2118|       }
# 2119|       fflush(mesg);
# 2120|->     fgets(buf, SPLIT_MAXPATH, stdin);
# 2121|       /* remove any newline */
# 2122|       for (i = 0; buf[i]; i++) {

Error: COMPILER_WARNING (CWE-252): [#def2]
zip30/fileio.c:2143:7: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
# 2143 |       fgets(buf, SPLIT_MAXPATH, stdin);
#      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2141|         fprintf(mesg, "\n: ");
# 2142|         fflush(mesg);
# 2143|->       fgets(buf, SPLIT_MAXPATH, stdin);
# 2144|         is_readable = 0;
# 2145|         /* remove any newline */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def3]
zip30/fileio.c:2292:3: warning[-Wanalyzer-null-argument]: use of NULL ‘split_dir’ where non-null expected
zip30/fileio.c:2568:8: enter_function: entry to ‘bfwrite’
zip30/fileio.c:2635:6: branch_true: following ‘true’ branch (when ‘bytes_to_write != 0’)...
zip30/fileio.c:2636:9: branch_true: ...to here
zip30/fileio.c:2636:8: branch_true: following ‘true’ branch...
zip30/fileio.c:2638:25: branch_true: ...to here
zip30/fileio.c:2658:9: call_function: calling ‘close_split’ from ‘bfwrite’
zip30/fileio.c:2658:9: return_function: returning to ‘bfwrite’ from ‘close_split’
zip30/fileio.c:2678:12: branch_true: following ‘true’ branch...
zip30/fileio.c:2679:15: branch_true: ...to here
zip30/fileio.c:2679:15: call_function: calling ‘ask_for_split_write_path’ from ‘bfwrite’
# 2290|       ZIPERR(ZE_MEM, "split path");
# 2291|     }
# 2292|->   strcpy(split_dir, out_path);
# 2293|   
# 2294|     /* remove any name at end */

Error: COMPILER_WARNING (CWE-252): [#def4]
zip30/fileio.c: scope_hint: In function ‘ask_for_split_write_path’
zip30/fileio.c:2324:5: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
# 2324 |     fgets(buf, FNMAX, stdin);
#      |     ^~~~~~~~~~~~~~~~~~~~~~~~
# 2322|       fprintf(mesg, "\nPath (or hit ENTER to continue): ");
# 2323|       fflush(mesg);
# 2324|->     fgets(buf, FNMAX, stdin);
# 2325|       /* remove any newline */
# 2326|       for (i = 0; buf[i]; i++) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def5]
zip30/fileio.c:2527:3: warning[-Wanalyzer-null-argument]: use of NULL ‘split_path’ where non-null expected
zip30/fileio.c:2568:8: enter_function: entry to ‘bfwrite’
zip30/fileio.c:2635:6: branch_true: following ‘true’ branch (when ‘bytes_to_write != 0’)...
zip30/fileio.c:2636:9: branch_true: ...to here
zip30/fileio.c:2636:8: branch_true: following ‘true’ branch...
zip30/fileio.c:2638:25: branch_true: ...to here
zip30/fileio.c:2658:9: call_function: calling ‘close_split’ from ‘bfwrite’
# 2525|     }
# 2526|     /* copy base_path except for end zip */
# 2527|->   strcpy(split_path, base_path);
# 2528|     split_path[base_len] = '\0';
# 2529|     /* add extension */

Error: GCC_ANALYZER_WARNING (CWE-457): [#def6]
zip30/fileio.c:3018:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘&mb’
zip30/fileio.c:2996:11: enter_function: entry to ‘ucs4_string_to_utf8’
zip30/fileio.c:3008:15: call_function: calling ‘utf8_from_ucs4_char’ from ‘ucs4_string_to_utf8’
zip30/fileio.c:3008:15: return_function: returning to ‘ucs4_string_to_utf8’ from ‘utf8_from_ucs4_char’
zip30/fileio.c:3010:8: branch_false: following ‘false’ branch...
zip30/fileio.c:3014:5: branch_false: ...to here
zip30/fileio.c:3017:8: branch_true: following ‘true’ branch...
zip30/fileio.c:3018:7: branch_true: ...to here
zip30/fileio.c:3018:7: danger: use of uninitialized value ‘&mb’ here
# 3016|         c = mbl;
# 3017|       if (utf8buf && count < buflen)
# 3018|->       strncpy(utf8buf + count, mb, c);
# 3019|       if (mbl == 1 && !mb[0])
# 3020|         return count;           /* terminating nul */

Error: COMPILER_WARNING: [#def7]
zip30/fileio.c: scope_hint: In function ‘ucs4_string_to_utf8.part.0’
zip30/fileio.c:3018:7: warning[-Wstringop-truncation]: ‘strncpy’ output may be truncated copying between 0 and 1 bytes from a string of length 5
# 3018 |       strncpy(utf8buf + count, mb, c);
#      |       ^
# 3016|         c = mbl;
# 3017|       if (utf8buf && count < buflen)
# 3018|->       strncpy(utf8buf + count, mb, c);
# 3019|       if (mbl == 1 && !mb[0])
# 3020|         return count;           /* terminating nul */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def8]
zip30/fileio.c:3173:3: warning[-Wanalyzer-null-argument]: use of NULL ‘r’ where non-null expected
zip30/fileio.c:3161:17: branch_true: following ‘true’ branch (when ‘len != 8’)...
zip30/fileio.c:3162:5: branch_true: ...to here
zip30/fileio.c:3165:17: branch_false: following ‘false’ branch (when ‘w == 0’)...
zip30/fileio.c:3170:12: branch_false: ...to here
zip30/fileio.c:3170:12: acquire_memory: allocated here
zip30/fileio.c:3170:6: release_memory: assuming ‘r’ is NULL
zip30/fileio.c:3170:6: branch_true: following ‘true’ branch (when ‘r’ is NULL)...
zip30/fileio.c:3171:5: branch_true: ...to here
zip30/fileio.c:3173:3: danger: argument 1 (‘r’) NULL where non-null expected
#argument 1 of ‘__builtin_memcpy’ must be non-null
# 3171|       ZIPERR(ZE_MEM, "wide_char_to_escape_string");
# 3172|     }
# 3173|->   strcpy(r, "#");
# 3174|     /* either 2 bytes or 4 bytes */
# 3175|     if (len < 3) {

Error: COMPILER_WARNING: [#def9]
zip30/fileio.c: scope_hint: In function ‘wide_to_local_string’
zip30/fileio.c:3281:7: warning[-Wunused-but-set-variable=]: variable ‘state_dependent’ set but not used
# 3281 |   int state_dependent;
#      |       ^~~~~~~~~~~~~~~
# 3279|     wchar_t wc;
# 3280|     int b;
# 3281|->   int state_dependent;
# 3282|     int wsize = 0;
# 3283|     int max_bytes = MB_CUR_MAX;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def10]
zip30/fileio.c:3288:19: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘wide_string’
zip30/fileio.c:3465:7: enter_function: entry to ‘utf8_to_local_string’
zip30/fileio.c:3468:25: call_function: calling ‘utf8_to_wide_string’ from ‘utf8_to_local_string’
zip30/fileio.c:3468:25: return_function: returning to ‘utf8_to_local_string’ from ‘utf8_to_wide_string’
zip30/fileio.c:3469:15: call_function: calling ‘wide_to_local_string’ from ‘utf8_to_local_string’
# 3286|     char *local_string = NULL;
# 3287|   
# 3288|->   for (wsize = 0; wide_string[wsize]; wsize++) ;
# 3289|   
# 3290|     if (MAX_ESCAPE_BYTES > max_bytes)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def11]
zip30/fileio.c:3298:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘buffer’
zip30/fileio.c:3293:25: acquire_memory: allocated here
zip30/fileio.c:3293:6: release_memory: assuming ‘buffer’ is NULL
zip30/fileio.c:3293:6: branch_true: following ‘true’ branch (when ‘buffer’ is NULL)...
zip30/fileio.c:3294:5: branch_true: ...to here
zip30/fileio.c:3298:3: danger: dereference of NULL ‘buffer’
# 3296|   
# 3297|     /* convert it */
# 3298|->   buffer[0] = '\0';
# 3299|     /* set initial state if state-dependent encoding */
# 3300|     wc = (wchar_t)'a';

Error: COMPILER_WARNING: [#def12]
zip30/fileio.c: scope_hint: In function ‘wide_to_local_string’
zip30/fileio.c:3318:9: warning[-Wstringop-truncation]: ‘__strncat_chk’ output may be truncated copying 1 byte from a string of length 8
# 3318 |         strncat(buffer, buf, b);
#      |         ^
# 3316|         if (b == 1 && (uch)buf[0] <= 0x7f) {
# 3317|           /* ASCII */
# 3318|->         strncat(buffer, buf, b);
# 3319|         } else {
# 3320|           /* use escape for wide character */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def13]
zip30/fileio.c:3345:3: warning[-Wanalyzer-null-argument]: use of NULL ‘local_string’ where non-null expected
zip30/fileio.c:3293:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
zip30/fileio.c:3298:3: branch_false: ...to here
zip30/fileio.c:3341:31: acquire_memory: allocated here
zip30/fileio.c:3341:6: release_memory: assuming ‘local_string’ is NULL
zip30/fileio.c:3341:6: branch_true: following ‘true’ branch (when ‘local_string’ is NULL)...
zip30/fileio.c:3342:5: branch_true: ...to here
zip30/fileio.c:3345:3: danger: argument 1 (‘local_string’) NULL where non-null expected
# 3343|       ZIPERR(ZE_MEM, "wide_to_local_string");
# 3344|     }
# 3345|->   strcpy(local_string, buffer);
# 3346|     free(buffer);
# 3347|   

Error: GCC_ANALYZER_WARNING (CWE-457): [#def14]
zip30/fileio.c:3345:3: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*buffer’
zip30/fileio.c:3293:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
zip30/fileio.c:3298:3: branch_false: ...to here
zip30/fileio.c:3341:6: branch_true: following ‘true’ branch (when ‘local_string’ is NULL)...
zip30/fileio.c:3342:5: branch_true: ...to here
zip30/fileio.c:3345:3: danger: use of uninitialized value ‘*buffer’ here
# 3343|       ZIPERR(ZE_MEM, "wide_to_local_string");
# 3344|     }
# 3345|->   strcpy(local_string, buffer);
# 3346|     free(buffer);
# 3347|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def15]
zip30/fileio.c:3363:19: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘wide_string’
zip30/fileio.c:3249:7: enter_function: entry to ‘local_to_escape_string’
zip30/fileio.c:3252:25: call_function: calling ‘local_to_wide_string’ from ‘local_to_escape_string’
zip30/fileio.c:3252:25: return_function: returning to ‘local_to_escape_string’ from ‘local_to_wide_string’
zip30/fileio.c:3253:25: call_function: calling ‘wide_to_escape_string’ from ‘local_to_escape_string’
# 3361|     char *escape_string = NULL;
# 3362|   
# 3363|->   for (wsize = 0; wide_string[wsize]; wsize++) ;
# 3364|   
# 3365|     if ((buffer = (char *)malloc(wsize * MAX_ESCAPE_BYTES + 1)) == NULL) {

Error: GCC_ANALYZER_WARNING (CWE-476): [#def16]
zip30/fileio.c:3370:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘buffer’
zip30/fileio.c:3365:25: acquire_memory: allocated here
zip30/fileio.c:3365:6: release_memory: assuming ‘buffer’ is NULL
zip30/fileio.c:3365:6: branch_true: following ‘true’ branch (when ‘buffer’ is NULL)...
zip30/fileio.c:3366:5: branch_true: ...to here
zip30/fileio.c:3370:3: danger: dereference of NULL ‘buffer’
# 3368|   
# 3369|     /* convert it */
# 3370|->   buffer[0] = '\0';
# 3371|     for (i = 0; i < wsize; i++) {
# 3372|       if (wide_string[i] <= 0x7f && isprint((char)wide_string[i])) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def17]
zip30/fileio.c:3387:3: warning[-Wanalyzer-null-argument]: use of NULL ‘escape_string’ where non-null expected
zip30/fileio.c:3365:6: branch_false: following ‘false’ branch (when ‘buffer’ is non-NULL)...
zip30/fileio.c:3370:3: branch_false: ...to here
zip30/fileio.c:3384:32: acquire_memory: allocated here
zip30/fileio.c:3384:6: release_memory: assuming ‘escape_string’ is NULL
zip30/fileio.c:3384:6: branch_true: following ‘true’ branch (when ‘escape_string’ is NULL)...
zip30/fileio.c:3385:5: branch_true: ...to here
zip30/fileio.c:3387:3: danger: argument 1 (‘escape_string’) NULL where non-null expected
# 3385|       ZIPERR(ZE_MEM, "wide_to_escape_string");
# 3386|     }
# 3387|->   strcpy(escape_string, buffer);
# 3388|     free(buffer);
# 3389|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def18]
zip30/fileio.c:3429:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cp_dst’
zip30/fileio.c:3415:30: acquire_memory: allocated here
zip30/fileio.c:3415:6: release_memory: assuming ‘temp_string’ is NULL
zip30/fileio.c:3415:6: branch_true: following ‘true’ branch (when ‘temp_string’ is NULL)...
zip30/fileio.c:3416:5: branch_true: ...to here
zip30/fileio.c:3427:10: branch_true: following ‘true’ branch...
zip30/fileio.c:3428:24: branch_true: ...to here
zip30/fileio.c:3428:8: branch_true: following ‘true’ branch...
zip30/fileio.c:3429:7: branch_true: ...to here
zip30/fileio.c:3429:7: danger: dereference of NULL ‘cp_dst’
# 3427|     while (*cp_src != '\0') {
# 3428|       if ((unsigned char)*cp_src < ' ') {
# 3429|->       *cp_dst++ = '^';
# 3430|         *cp_dst++ = '@'+ *cp_src++;
# 3431|       }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def19]
zip30/fileio.c:3433:7: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cp_dst’
zip30/fileio.c:3415:30: acquire_memory: allocated here
zip30/fileio.c:3415:6: release_memory: assuming ‘temp_string’ is NULL
zip30/fileio.c:3415:6: branch_true: following ‘true’ branch (when ‘temp_string’ is NULL)...
zip30/fileio.c:3416:5: branch_true: ...to here
zip30/fileio.c:3427:10: branch_true: following ‘true’ branch...
zip30/fileio.c:3428:24: branch_true: ...to here
zip30/fileio.c:3428:8: branch_false: following ‘false’ branch...
zip30/fileio.c:3433:20: branch_false: ...to here
zip30/fileio.c:3433:7: danger: dereference of NULL ‘cp_dst’
# 3431|       }
# 3432|       else {
# 3433|->       *cp_dst++ = *cp_src++;
# 3434|       }
# 3435|     }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def20]
zip30/fileio.c:3436:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cp_dst’
zip30/fileio.c:3415:30: acquire_memory: allocated here
zip30/fileio.c:3415:6: release_memory: assuming ‘temp_string’ is NULL
zip30/fileio.c:3415:6: branch_true: following ‘true’ branch (when ‘temp_string’ is NULL)...
zip30/fileio.c:3416:5: branch_true: ...to here
zip30/fileio.c:3427:10: branch_false: following ‘false’ branch...
zip30/fileio.c:3436:3: branch_false: ...to here
zip30/fileio.c:3436:3: danger: dereference of NULL ‘cp_dst’
# 3434|       }
# 3435|     }
# 3436|->   *cp_dst = '\0';
# 3437|   # else /* not UNIX */
# 3438|     strcpy(temp_string, local_string);

Error: GCC_ANALYZER_WARNING (CWE-688): [#def21]
zip30/fileio.c:3458:3: warning[-Wanalyzer-null-argument]: use of NULL ‘display_string’ where non-null expected
zip30/fileio.c:3415:6: branch_false: following ‘false’ branch (when ‘temp_string’ is non-NULL)...
zip30/fileio.c:3427:9: branch_false: ...to here
zip30/fileio.c:3427:10: branch_false: following ‘false’ branch...
zip30/fileio.c:3436:3: branch_false: ...to here
zip30/fileio.c:3455:33: acquire_memory: allocated here
zip30/fileio.c:3455:6: release_memory: assuming ‘display_string’ is NULL
zip30/fileio.c:3455:6: branch_true: following ‘true’ branch (when ‘display_string’ is NULL)...
zip30/fileio.c:3456:5: branch_true: ...to here
zip30/fileio.c:3458:3: danger: argument 1 (‘display_string’) NULL where non-null expected
# 3456|       ZIPERR(ZE_MEM, "local_to_display_string");
# 3457|     }
# 3458|->   strcpy(display_string, temp_string);
# 3459|     free(temp_string);
# 3460|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def22]
zip30/fileio.c:3512:19: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘wide_string’
zip30/fileio.c:3496:6: branch_false: following ‘false’ branch (when ‘wsize != -1’)...
zip30/fileio.c:3502:38: branch_false: ...to here
zip30/fileio.c:3509:32: acquire_memory: allocated here
zip30/fileio.c:3509:6: release_memory: assuming ‘wide_string’ is NULL
zip30/fileio.c:3509:6: branch_true: following ‘true’ branch (when ‘wide_string’ is NULL)...
zip30/fileio.c:3510:5: branch_true: ...to here
zip30/fileio.c:3512:19: danger: dereference of NULL ‘wide_string + (long unsigned int)wsize * 8’
# 3510|       ZIPERR(ZE_MEM, "local_to_wide_string");
# 3511|     }
# 3512|->   for (wsize = 0; (wide_string[wsize] = (zwchar)wc_string[wsize]); wsize++) ;
# 3513|     wide_string[wsize] = (zwchar)0;
# 3514|     free(wc_string);

Error: COMPILER_WARNING: [#def23]
zip30/fileio.c: scope_hint: At top level
zip30/fileio.c:3727:24: warning[-Wunused-const-variable=]: ‘no_arg_files_err’ defined but not used
# 3727 | static ZCONST char Far no_arg_files_err[] = "argument files not enabled\n";
#      |                        ^~~~~~~~~~~~~~~~
# 3725|   static ZCONST char Far long_op_not_sup_err[] = "long option '%s' not supported";
# 3726|   
# 3727|-> static ZCONST char Far no_arg_files_err[] = "argument files not enabled\n";
# 3728|   
# 3729|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def24]
zip30/fileio.c:3799:9: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘new_args’
zip30/fileio.c:3782:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:3782:6: branch_false: ...to here
zip30/fileio.c:3789:29: acquire_memory: allocated here
zip30/fileio.c:3789:6: release_memory: assuming ‘new_args’ is NULL
zip30/fileio.c:3789:6: branch_true: following ‘true’ branch (when ‘new_args’ is NULL)...
zip30/fileio.c:3790:5: branch_true: ...to here
zip30/fileio.c:3793:15: branch_true: following ‘true’ branch...
zip30/fileio.c:3799:9: danger: dereference of NULL ‘new_args + (long unsigned int)j * 8’
# 3797|         break;
# 3798|       }
# 3799|->     if ((new_args[j] = malloc(strlen(args[j]) + 1)) == NULL) {
# 3800|         free_args(new_args);
# 3801|         oERR(ZE_MEM, "ca");

Error: GCC_ANALYZER_WARNING (CWE-416): [#def25]
zip30/fileio.c:3803:5: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘new_args’
zip30/fileio.c:3775:8: enter_function: entry to ‘copy_args’
zip30/fileio.c:3782:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:3782:6: branch_false: ...to here
zip30/fileio.c:3789:29: acquire_memory: allocated here
zip30/fileio.c:3789:6: branch_false: following ‘false’ branch (when ‘new_args’ is non-NULL)...
zip30/fileio.c:3793:3: branch_false: ...to here
zip30/fileio.c:3793:15: branch_true: following ‘true’ branch...
zip30/fileio.c:3799:8: branch_true: following ‘true’ branch...
zip30/fileio.c:3800:7: call_function: inlined call to ‘free_args’ from ‘copy_args’
zip30/fileio.c:3800:7: call_function: inlined call to ‘free_args’ from ‘copy_args’
zip30/fileio.c:3803:5: danger: use after ‘free’ of ‘new_args + (long unsigned int)j * 8’; freed at [(19)](sarif:/runs/0/results/17/codeFlows/0/threadFlows/0/locations/18)
# 3801|         oERR(ZE_MEM, "ca");
# 3802|       }
# 3803|->     strcpy(new_args[j], args[j]);
# 3804|     }
# 3805|     new_args[j] = NULL;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def26]
zip30/fileio.c:3805:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘new_args’
zip30/fileio.c:3782:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:3782:6: branch_false: ...to here
zip30/fileio.c:3789:29: acquire_memory: allocated here
zip30/fileio.c:3789:6: release_memory: assuming ‘new_args’ is NULL
zip30/fileio.c:3789:6: branch_true: following ‘true’ branch (when ‘new_args’ is NULL)...
zip30/fileio.c:3790:5: branch_true: ...to here
zip30/fileio.c:3805:3: danger: dereference of NULL ‘new_args + (long unsigned int)j * 8’
# 3803|       strcpy(new_args[j], args[j]);
# 3804|     }
# 3805|->   new_args[j] = NULL;
# 3806|   
# 3807|     return new_args;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def27]
zip30/fileio.c:3880:8: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘newargs’
zip30/fileio.c:3853:7: branch_false: following ‘false’ branch (when ‘pargs’ is non-NULL)...
zip30/fileio.c:3856:4: branch_false: ...to here
zip30/fileio.c:3864:7: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:3871:36: branch_false: ...to here
zip30/fileio.c:3871:29: acquire_memory: allocated here
zip30/fileio.c:3871:7: release_memory: assuming ‘newargs’ is NULL
zip30/fileio.c:3871:7: branch_true: following ‘true’ branch (when ‘newargs’ is NULL)...
zip30/fileio.c:3872:6: branch_true: ...to here
zip30/fileio.c:3878:7: branch_true: following ‘true’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:3878:7: branch_true: ...to here
zip30/fileio.c:3879:13: branch_true: following ‘true’ branch...
zip30/fileio.c:3880:8: danger: dereference of NULL ‘newargs + (long unsigned int)argnum * 8’
# 3878|      if (args) {
# 3879|        for (; args[argnum] && argnum < at_arg; argnum++) {
# 3880|->        newargs[newargnum++] = args[argnum];
# 3881|        }
# 3882|      }

Error: GCC_ANALYZER_WARNING (CWE-688): [#def28]
zip30/fileio.c:3887:4: warning[-Wanalyzer-null-argument]: use of NULL ‘newarg’ where non-null expected
zip30/fileio.c:3853:7: branch_false: following ‘false’ branch (when ‘pargs’ is non-NULL)...
zip30/fileio.c:3856:4: branch_false: ...to here
zip30/fileio.c:3864:7: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:3871:36: branch_false: ...to here
zip30/fileio.c:3871:7: branch_false: following ‘false’ branch (when ‘newargs’ is non-NULL)...
zip30/fileio.c:3878:7: branch_false: ...to here
zip30/fileio.c:3884:27: acquire_memory: allocated here
zip30/fileio.c:3884:7: release_memory: assuming ‘newarg’ is NULL
zip30/fileio.c:3884:7: branch_true: following ‘true’ branch (when ‘newarg’ is NULL)...
zip30/fileio.c:3885:6: branch_true: ...to here
zip30/fileio.c:3887:4: danger: argument 1 (‘newarg’) NULL where non-null expected
# 3885|        oERR(ZE_MEM, "ia");
# 3886|      }
# 3887|->    strcpy(newarg, arg);
# 3888|   
# 3889|      newargs[newargnum++] = newarg;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def29]
zip30/fileio.c:3889:4: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘newargs’
zip30/fileio.c:3853:7: branch_false: following ‘false’ branch (when ‘pargs’ is non-NULL)...
zip30/fileio.c:3856:4: branch_false: ...to here
zip30/fileio.c:3864:7: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:3871:36: branch_false: ...to here
zip30/fileio.c:3871:29: acquire_memory: allocated here
zip30/fileio.c:3871:7: release_memory: assuming ‘newargs’ is NULL
zip30/fileio.c:3871:7: branch_true: following ‘true’ branch (when ‘newargs’ is NULL)...
zip30/fileio.c:3872:6: branch_true: ...to here
zip30/fileio.c:3884:7: branch_false: following ‘false’ branch (when ‘newarg’ is non-NULL)...
zip30/fileio.c:3887:4: branch_false: ...to here
zip30/fileio.c:3889:4: danger: dereference of NULL ‘newargs + (long unsigned int)argnum * 8’
# 3887|      strcpy(newarg, arg);
# 3888|   
# 3889|->    newargs[newargnum++] = newarg;
# 3890|      if (args) {
# 3891|        for ( ; args[argnum]; argnum++) {

Error: GCC_ANALYZER_WARNING (CWE-688): [#def30]
zip30/fileio.c:4200:3: warning[-Wanalyzer-null-argument]: use of NULL ‘arg’ where non-null expected
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: release_memory: assuming ‘arg’ is NULL
zip30/fileio.c:4197:6: branch_true: following ‘true’ branch (when ‘arg’ is NULL)...
zip30/fileio.c:4198:5: branch_true: ...to here
zip30/fileio.c:4200:3: danger: argument 1 (‘arg’) NULL where non-null expected
# 4198|       oERR(ZE_MEM, "glo");
# 4199|     }
# 4200|->   strcpy(arg, args[argnum]);
# 4201|   
# 4202|     /* get option */

Error: GCC_ANALYZER_WARNING (CWE-415): [#def31]
zip30/fileio.c:4267:5: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4170:21: enter_function: entry to ‘get_longopt’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4211:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4219:7: branch_false: ...to here
zip30/fileio.c:4250:6: branch_true: following ‘true’ branch (when ‘match == -1’)...
zip30/fileio.c:4251:5: branch_true: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4265:6: branch_true: following ‘true’ branch...
zip30/fileio.c:4266:5: call_function: calling ‘optionerr’ from ‘get_longopt’
zip30/fileio.c:4266:5: return_function: returning to ‘get_longopt’ from ‘optionerr’
zip30/fileio.c:4267:5: danger: second ‘free’ here; first ‘free’ was at [(14)](sarif:/runs/0/results/23/codeFlows/0/threadFlows/0/locations/13)
# 4265|     if (*negated && options[match].negatable == o_NOT_NEGATABLE) {
# 4266|       optionerr(optionerrbuf, op_not_neg_err, match, 1);
# 4267|->     free(arg);
# 4268|       if (depth > 0) {
# 4269|         /* unwind */

Error: GCC_ANALYZER_WARNING (CWE-415): [#def32]
zip30/fileio.c:4282:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4211:6: branch_true: following ‘true’ branch...
zip30/fileio.c:4213:5: branch_true: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4277:6: branch_true: following ‘true’ branch...
zip30/fileio.c:4279:8: branch_true: ...to here
zip30/fileio.c:4279:8: branch_true: following ‘true’ branch (when ‘valuestart’ is non-NULL)...
zip30/fileio.c:4281:36: branch_true: ...to here
zip30/fileio.c:4281:10: branch_true: following ‘true’ branch...
zip30/fileio.c:4282:9: branch_true: ...to here
zip30/fileio.c:4282:9: danger: second ‘free’ here; first ‘free’ was at [(11)](sarif:/runs/0/results/24/codeFlows/0/threadFlows/0/locations/10)
# 4280|         /* option=value */
# 4281|         if ((*value = (char *)malloc(strlen(valuestart) + 1)) == NULL) {
# 4282|->         free(arg);
# 4283|           oERR(ZE_MEM, "glo");
# 4284|         }

Error: GCC_ANALYZER_WARNING (CWE-415): [#def33]
zip30/fileio.c:4295:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4211:6: branch_true: following ‘true’ branch...
zip30/fileio.c:4213:5: branch_true: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4277:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4287:14: branch_false: ...to here
zip30/fileio.c:4292:8: branch_true: following ‘true’ branch (when ‘valuestart’ is non-NULL)...
zip30/fileio.c:4294:36: branch_true: ...to here
zip30/fileio.c:4294:10: branch_true: following ‘true’ branch...
zip30/fileio.c:4295:9: branch_true: ...to here
zip30/fileio.c:4295:9: danger: second ‘free’ here; first ‘free’ was at [(11)](sarif:/runs/0/results/25/codeFlows/0/threadFlows/0/locations/10)
# 4293|         /* option=value */
# 4294|         if ((*value = (char *)malloc(strlen(valuestart) + 1)) == NULL) {
# 4295|->         free(arg);
# 4296|           oERR(ZE_MEM, "glo");
# 4297|         }

Error: GCC_ANALYZER_WARNING (CWE-415): [#def34]
zip30/fileio.c:4303:11: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4277:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4287:14: branch_false: ...to here
zip30/fileio.c:4292:8: branch_false: following ‘false’ branch (when ‘valuestart’ is NULL)...
zip30/fileio.c:4301:16: branch_false: ...to here
zip30/fileio.c:4301:10: branch_true: following ‘true’ branch...
zip30/fileio.c:4302:38: branch_true: ...to here
zip30/fileio.c:4302:12: branch_true: following ‘true’ branch...
zip30/fileio.c:4303:11: branch_true: ...to here
zip30/fileio.c:4303:11: danger: second ‘free’ here; first ‘free’ was at [(9)](sarif:/runs/0/results/26/codeFlows/0/threadFlows/0/locations/8)
# 4301|         if (args[argnum + 1]) {
# 4302|           if ((*value = (char *)malloc(strlen(args[argnum + 1]) + 1)) == NULL) {
# 4303|->           free(arg);
# 4304|             oERR(ZE_MEM, "glo");
# 4305|           }

Error: GCC_ANALYZER_WARNING (CWE-415): [#def35]
zip30/fileio.c:4316:9: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4170:21: enter_function: entry to ‘get_longopt’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4277:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4287:14: branch_false: ...to here
zip30/fileio.c:4292:8: branch_false: following ‘false’ branch (when ‘valuestart’ is NULL)...
zip30/fileio.c:4301:16: branch_false: ...to here
zip30/fileio.c:4301:10: branch_false: following ‘false’ branch...
zip30/fileio.c:4315:9: branch_false: ...to here
zip30/fileio.c:4315:9: call_function: calling ‘optionerr’ from ‘get_longopt’
zip30/fileio.c:4315:9: return_function: returning to ‘get_longopt’ from ‘optionerr’
zip30/fileio.c:4316:9: danger: second ‘free’ here; first ‘free’ was at [(10)](sarif:/runs/0/results/27/codeFlows/0/threadFlows/0/locations/9)
# 4314|           /* no value found */
# 4315|           optionerr(optionerrbuf, op_req_val_err, match, 1);
# 4316|->         free(arg);
# 4317|           if (depth > 0) {
# 4318|             /* unwind */

Error: GCC_ANALYZER_WARNING (CWE-415): [#def36]
zip30/fileio.c:4331:7: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4170:21: enter_function: entry to ‘get_longopt’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4211:6: branch_true: following ‘true’ branch...
zip30/fileio.c:4213:5: branch_true: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4277:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4287:14: branch_false: ...to here
zip30/fileio.c:4287:13: branch_false: following ‘false’ branch...
zip30/fileio.c:4287:14: branch_false: ...to here
zip30/fileio.c:4287:14: branch_false: following ‘false’ branch...
zip30/fileio.c:4287:14: branch_false: ...to here
zip30/fileio.c:4287:14: branch_false: following ‘false’ branch...
zip30/fileio.c:4326:13: branch_false: ...to here
zip30/fileio.c:4326:13: branch_true: following ‘true’ branch...
zip30/fileio.c:4328:8: branch_true: ...to here
zip30/fileio.c:4328:8: branch_true: following ‘true’ branch (when ‘valuestart’ is non-NULL)...
zip30/fileio.c:4330:7: branch_true: ...to here
zip30/fileio.c:4330:7: call_function: calling ‘optionerr’ from ‘get_longopt’
zip30/fileio.c:4330:7: return_function: returning to ‘get_longopt’ from ‘optionerr’
zip30/fileio.c:4331:7: danger: second ‘free’ here; first ‘free’ was at [(12)](sarif:/runs/0/results/28/codeFlows/0/threadFlows/0/locations/11)
# 4329|         /* --option=value */
# 4330|         optionerr(optionerrbuf, op_no_allow_val_err, match, 1);
# 4331|->       free(arg);
# 4332|         if (depth > 0) {
# 4333|           oWARN(optionerrbuf);

Error: GCC_ANALYZER_WARNING (CWE-415): [#def37]
zip30/fileio.c:4340:3: warning[-Wanalyzer-double-free]: double-‘free’ of ‘arg’
zip30/fileio.c:4188:6: branch_false: following ‘false’ branch (when ‘args’ is non-NULL)...
zip30/fileio.c:4192:11: branch_false: ...to here
zip30/fileio.c:4192:6: branch_false: following ‘false’ branch...
zip30/fileio.c:4197:29: branch_false: ...to here
zip30/fileio.c:4197:22: acquire_memory: allocated here
zip30/fileio.c:4197:6: branch_false: following ‘false’ branch (when ‘arg’ is non-NULL)...
zip30/fileio.c:4200:3: branch_false: ...to here
zip30/fileio.c:4252:5: release_memory: first ‘free’ here
zip30/fileio.c:4253:8: branch_false: following ‘false’ branch (when ‘depth <= 0’)...
zip30/fileio.c:4257:7: branch_false: ...to here
zip30/fileio.c:4279:8: branch_false: following ‘false’ branch (when ‘valuestart’ is NULL)...
zip30/fileio.c:4340:3: branch_false: ...to here
zip30/fileio.c:4340:3: danger: second ‘free’ here; first ‘free’ was at [(9)](sarif:/runs/0/results/29/codeFlows/0/threadFlows/0/locations/8)
# 4338|       }
# 4339|     }
# 4340|->   free(arg);
# 4341|   
# 4342|     *option_num = match;

Error: COMPILER_WARNING (CWE-252): [#def38]
zip30/ttyio.c: scope_hint: In function ‘getp’
zip30/ttyio.c:628:13: warning[-Wunused-result]: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’
#  628 |             read(f, &c, 1);
#      |             ^~~~~~~~~~~~~~
#  626|           echoff(f);
#  627|           do {                    /* read line, keeping n */
#  628|->             read(f, &c, 1);
#  629|               if (i < n)
#  630|                   p[i++] = c;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def39]
zip30/unix/unix.c:256:10: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘t’
zip30/unix/unix.c:243:6: branch_true: following ‘true’ branch...
zip30/unix/unix.c:252:8: branch_false: following ‘false’ branch...
zip30/unix/unix.c:252:8: branch_false: ...to here
zip30/unix/unix.c:256:10: danger: dereference of NULL ‘t’
#  254|     } else
#  255|         t = x;
#  256|->   while (*t == '/')
#  257|       t++;                /* strip leading '/' chars to get a relative path */
#  258|     while (*t == '.' && t[1] == '/')

Error: GCC_ANALYZER_WARNING (CWE-688): [#def40]
zip30/unix/unix.c:361:3: warning[-Wanalyzer-null-argument]: use of NULL ‘name’ where non-null expected
zip30/unix/unix.c:349:6: branch_false: following ‘false’ branch...
zip30/unix/unix.c:358:22: branch_false: ...to here
zip30/unix/unix.c:358:15: acquire_memory: allocated here
zip30/unix/unix.c:358:6: release_memory: assuming ‘name’ is NULL
zip30/unix/unix.c:358:6: branch_true: following ‘true’ branch (when ‘name’ is NULL)...
zip30/unix/unix.c:359:5: branch_true: ...to here
zip30/unix/unix.c:361:3: danger: argument 1 (‘name’) NULL where non-null expected
#  359|       ZIPERR(ZE_MEM, "filetime");
#  360|     }
#  361|->   strcpy(name, f);
#  362|     if (name[len - 1] == '/')
#  363|       name[len - 1] = '\0';

Error: CPPCHECK_WARNING (CWE-415): [#def41]
zip30/unix/unix.c:378: error[doubleFree]: Memory pointed to by 'name' is freed twice.
#  376|       return 0;
#  377|     }
#  378|->   free(name);
#  379|   
#  380|     if (a != NULL) {

Error: GCC_ANALYZER_WARNING (CWE-415): [#def42]
zip30/unix/unix.c:378:3: warning[-Wanalyzer-double-free]: double-‘free’ of ‘name’
zip30/unix/unix.c:349:6: branch_false: following ‘false’ branch...
zip30/unix/unix.c:358:22: branch_false: ...to here
zip30/unix/unix.c:358:15: acquire_memory: allocated here
zip30/unix/unix.c:358:6: branch_false: following ‘false’ branch (when ‘name’ is non-NULL)...
zip30/unix/unix.c:361:3: branch_false: ...to here
zip30/unix/unix.c:365:6: branch_true: following ‘true’ branch (when the strings are equal)...
zip30/unix/unix.c:366:9: branch_true: ...to here
zip30/unix/unix.c:366:8: branch_true: following ‘true’ branch...
zip30/unix/unix.c:367:7: branch_true: ...to here
zip30/unix/unix.c:367:7: release_memory: first ‘free’ here
zip30/unix/unix.c:378:3: danger: second ‘free’ here; first ‘free’ was at [(11)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/10)
#  376|       return 0;
#  377|     }
#  378|->   free(name);
#  379|   
#  380|     if (a != NULL) {

Error: CPPCHECK_WARNING (CWE-401): [#def43]
zip30/unix/unix.c:470: error[memleak]: Memory leak: extra
#  468|       return ZE_MEM;
#  469|     if ((cextra = (char *)malloc(z->ext + 4 + ef_data_size)) == NULL)
#  470|->     return ZE_MEM;
#  471|   
#  472|     if (z->ext)

Error: GCC_ANALYZER_WARNING (CWE-401): [#def44]
zip30/unix/unix.c:562:1: warning[-Wanalyzer-malloc-leak]: leak of ‘extra’
zip30/unix/unix.c:467:24: acquire_memory: allocated here
zip30/unix/unix.c:467:6: branch_false: following ‘false’ branch (when ‘extra’ is non-NULL)...
zip30/unix/unix.c:469:25: branch_false: ...to here
zip30/unix/unix.c:469:6: branch_true: following ‘true’ branch (when ‘cextra’ is NULL)...
zip30/unix/unix.c:469:6: branch_true: ...to here
zip30/unix/unix.c:562:1: danger: ‘extra’ leaks here; was allocated at [(1)](sarif:/runs/0/results/3/codeFlows/0/threadFlows/0/locations/0)
#  560|   
#  561|     return ZE_OK;
#  562|-> }
#  563|   
#  564|   

Error: GCC_ANALYZER_WARNING (CWE-688): [#def45]
zip30/unix/unix.c:581:3: warning[-Wanalyzer-null-argument]: use of NULL ‘name’ where non-null expected
zip30/unix/unix.c:578:15: acquire_memory: allocated here
zip30/unix/unix.c:578:6: release_memory: assuming ‘name’ is NULL
zip30/unix/unix.c:578:6: branch_true: following ‘true’ branch (when ‘name’ is NULL)...
zip30/unix/unix.c:579:5: branch_true: ...to here
zip30/unix/unix.c:581:3: danger: argument 1 (‘name’) NULL where non-null expected
#  579|       ZIPERR(ZE_MEM, "set_extra_field");
#  580|     }
#  581|->   strcpy(name, z->name);
#  582|     if (name[len - 1] == '/')
#  583|       name[len - 1] = '\0';

Error: COMPILER_WARNING (CWE-252): [#def46]
zip30/zipup.c:109: included_from: Included from here.
zip30/zipup.c: scope_hint: In function ‘file_read’
zip30/unix/zipup.h:21:22: warning[-Wunused-result]: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’
#   21 | #define zread(f,b,n) read(f,b,n)
#      |                      ^~~~~~~~~~~
zip30/zipup.c:1264:10: note: in expansion of macro ‘zread’
# 1264 |          zread(ifile, buf, 1); len = 1; /* keep single \r if EOF */
#      |          ^~~~~
#   19|   typedef int ftype;
#   20|   #define zopen(n,p) open(n,p)
#   21|-> #define zread(f,b,n) read(f,b,n)
#   22|   #define zclose(f) close(f)
#   23|   #define zerr(f) (k == (extent)(-1L))

Error: CPPCHECK_WARNING (CWE-476): [#def47]
zip30/util.c:837: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: bufptr
#  835|       if (bufptr == NULL)
#  836|           ziperr(ZE_MEM, "Can't get memory for arguments");
#  837|->     strcpy(bufptr, envptr);
#  838|   
#  839|       /* allocate a vector large enough for all args */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def48]
zip30/util.c:837:5: warning[-Wanalyzer-null-argument]: use of NULL ‘bufptr’ where non-null expected
zip30/util.c:829:9: branch_false: following ‘false’ branch...
zip30/util.c:833:12: branch_false: ...to here
zip30/util.c:834:14: acquire_memory: allocated here
zip30/util.c:835:8: release_memory: assuming ‘bufptr’ is NULL
zip30/util.c:835:8: branch_true: following ‘true’ branch (when ‘bufptr’ is NULL)...
zip30/util.c:836:9: branch_true: ...to here
zip30/util.c:837:5: danger: argument 1 (‘bufptr’) NULL where non-null expected
#  835|       if (bufptr == NULL)
#  836|           ziperr(ZE_MEM, "Can't get memory for arguments");
#  837|->     strcpy(bufptr, envptr);
#  838|   
#  839|       /* allocate a vector large enough for all args */

Error: CPPCHECK_WARNING (CWE-682): [#def49]
zip30/util.c:848: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  846|   
#  847|       /* copy the program name first, that's always true */
#  848|->     *(argv++) = *((*Pargv)++);
#  849|   
#  850|       /* copy the environment args first, may be changed */

Error: CPPCHECK_WARNING (CWE-476): [#def50]
zip30/util.c:848: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: argv++
#  846|   
#  847|       /* copy the program name first, that's always true */
#  848|->     *(argv++) = *((*Pargv)++);
#  849|   
#  850|       /* copy the environment args first, may be changed */

Error: GCC_ANALYZER_WARNING (CWE-476): [#def51]
zip30/util.c:848:5: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘argv’
zip30/util.c:829:9: branch_false: following ‘false’ branch...
zip30/util.c:833:12: branch_false: ...to here
zip30/util.c:835:8: branch_false: following ‘false’ branch (when ‘bufptr’ is non-NULL)...
zip30/util.c:837:5: branch_false: ...to here
zip30/util.c:840:21: acquire_memory: allocated here
zip30/util.c:841:8: release_memory: assuming ‘argv’ is NULL
zip30/util.c:841:8: branch_true: following ‘true’ branch (when ‘argv’ is NULL)...
zip30/util.c:842:9: branch_true: ...to here
zip30/util.c:848:5: danger: dereference of NULL ‘argv’
#  846|   
#  847|       /* copy the program name first, that's always true */
#  848|->     *(argv++) = *((*Pargv)++);
#  849|   
#  850|       /* copy the environment args first, may be changed */

Error: CPPCHECK_WARNING (CWE-682): [#def52]
zip30/zipfile.c:465: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: CPPCHECK_WARNING (CWE-476): [#def53]
zip30/zipfile.c:465: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pPtr++
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def54]
zip30/zipfile.c:465:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘block’
zip30/zipfile.c:5509:5: enter_function: entry to ‘putextended’
zip30/zipfile.c:5520:3: call_function: calling ‘append_ulong_to_mem’ from ‘putextended’
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: GCC_ANALYZER_WARNING (CWE-476): [#def55]
zip30/zipfile.c:465:3: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘pZ64Extra’
zip30/zipfile.c:6003:5: enter_function: entry to ‘zipcopy’
zip30/zipfile.c:6067:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:6075:7: branch_false: ...to here
zip30/zipfile.c:6083:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6108:37: branch_false: ...to here
zip30/zipfile.c:6108:6: branch_false: following ‘false’ branch (when ‘localz’ is non-NULL)...
zip30/zipfile.c:6115:17: branch_false: ...to here
zip30/zipfile.c:6173:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:7: branch_false: ...to here
zip30/zipfile.c:6180:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6182:3: branch_false: ...to here
zip30/zipfile.c:6185:17: call_function: calling ‘adjust_zip_local_entry’ from ‘zipcopy’
zip30/zipfile.c:6185:17: return_function: returning to ‘zipcopy’ from ‘adjust_zip_local_entry’
zip30/zipfile.c:6189:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6191:19: branch_true: ...to here
zip30/zipfile.c:6194:8: branch_true: following ‘true’ branch...
zip30/zipfile.c:6195:11: branch_true: ...to here
zip30/zipfile.c:6195:10: branch_true: following ‘true’ branch...
zip30/zipfile.c:6198:9: branch_true: ...to here
zip30/zipfile.c:6200:12: branch_false: following ‘false’ branch...
zip30/zipfile.c:6208:11: branch_false: ...to here
zip30/zipfile.c:6229:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6241:14: branch_true: ...to here
zip30/zipfile.c:6296:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6310:3: branch_false: ...to here
zip30/zipfile.c:6325:7: branch_false: following ‘false’ branch...
zip30/zipfile.c:6332:7: branch_false: ...to here
zip30/zipfile.c:6347:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6363:7: branch_false: ...to here
zip30/zipfile.c:6363:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6364:14: branch_true: ...to here
zip30/zipfile.c:6368:7: call_function: calling ‘putlocal’ from ‘zipcopy’
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: COMPILER_WARNING: [#def56]
zip30/zipfile.c:465:3: warning[-Wstringop-overflow=]: writing 1 byte into a region of size 0
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: COMPILER_WARNING: [#def57]
zip30/zipfile.c:465:3: warning[-Wstringop-overflow=]: writing 4 bytes into a region of size 0
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: COMPILER_WARNING: [#def58]
zip30/zipfile.c:465:11: warning[-Wstringop-overflow=]: writing 1 byte into a region of size 0
#  465 |   *pPtr++ = ((char)(usValue) & 0xff);
#      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: note: destination object is likely at address zero
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: COMPILER_WARNING: [#def59]
zip30/zipfile.c:465:11: warning[-Wstringop-overflow=]: writing 4 bytes into a region of size 0
#  465 |   *pPtr++ = ((char)(usValue) & 0xff);
#      |   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: note: destination object is likely at address zero
#  463|   #endif /* def NO_PROTO */
#  464|   {
#  465|->   *pPtr++ = ((char)(usValue) & 0xff);
#  466|     *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }

Error: COMPILER_WARNING: [#def60]
zip30/zipfile.c:466:3: warning[-Wstringop-overflow=]: writing 1 byte into a region of size 0
#  464|   {
#  465|     *pPtr++ = ((char)(usValue) & 0xff);
#  466|->   *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }
#  468|   

Error: COMPILER_WARNING: [#def61]
zip30/zipfile.c:466:9: warning[-Wstringop-overflow=]: writing 1 byte into a region of size 0
#  466 |   *pPtr = ((char)(usValue >> 8) & 0xff);
#      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: note: destination object is likely at address zero
#  464|   {
#  465|     *pPtr++ = ((char)(usValue) & 0xff);
#  466|->   *pPtr = ((char)(usValue >> 8) & 0xff);
#  467|   }
#  468|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def62]
zip30/zipfile.c:662:7: warning[-Wanalyzer-malloc-leak]: leak of ‘block’
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5387:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:5400:7: branch_false: ...to here
zip30/zipfile.c:5400:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5402:9: branch_true: ...to here
zip30/zipfile.c:5402:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5406:8: branch_true: following ‘true’ branch...
zip30/zipfile.c:5409:13: branch_true: ...to here
zip30/zipfile.c:5421:3: call_function: calling ‘append_ulong_to_mem’ from ‘putlocal’
zip30/zipfile.c:5421:3: return_function: returning to ‘putlocal’ from ‘append_ulong_to_mem’
zip30/zipfile.c:5422:3: call_function: calling ‘append_ushort_to_mem’ from ‘putlocal’
zip30/zipfile.c:5422:3: return_function: returning to ‘putlocal’ from ‘append_ushort_to_mem’
zip30/zipfile.c:5423:3: call_function: calling ‘append_ushort_to_mem’ from ‘putlocal’
zip30/zipfile.c:5423:3: return_function: returning to ‘putlocal’ from ‘append_ushort_to_mem’
zip30/zipfile.c:5424:3: call_function: calling ‘append_ushort_to_mem’ from ‘putlocal’
zip30/zipfile.c:5424:3: return_function: returning to ‘putlocal’ from ‘append_ushort_to_mem’
zip30/zipfile.c:5425:3: call_function: calling ‘append_ulong_to_mem’ from ‘putlocal’
zip30/zipfile.c:5425:3: return_function: returning to ‘putlocal’ from ‘append_ulong_to_mem’
zip30/zipfile.c:5426:3: call_function: calling ‘append_ulong_to_mem’ from ‘putlocal’
zip30/zipfile.c:5426:3: return_function: returning to ‘putlocal’ from ‘append_ulong_to_mem’
zip30/zipfile.c:5433:5: call_function: calling ‘append_ulong_to_mem’ from ‘putlocal’
zip30/zipfile.c:5433:5: return_function: returning to ‘putlocal’ from ‘append_ulong_to_mem’
zip30/zipfile.c:5434:5: call_function: calling ‘append_ulong_to_mem’ from ‘putlocal’
zip30/zipfile.c:5434:5: return_function: returning to ‘putlocal’ from ‘append_ulong_to_mem’
zip30/zipfile.c:5441:3: call_function: calling ‘append_ushort_to_mem’ from ‘putlocal’
zip30/zipfile.c:5441:3: return_function: returning to ‘putlocal’ from ‘append_ushort_to_mem’
zip30/zipfile.c:5446:3: call_function: calling ‘append_ushort_to_mem’ from ‘putlocal’
zip30/zipfile.c:5446:3: return_function: returning to ‘putlocal’ from ‘append_ushort_to_mem’
zip30/zipfile.c:5449:6: branch_true: following ‘true’ branch (when ‘use_uname != 0’)...
zip30/zipfile.c:5451:5: branch_true: ...to here
zip30/zipfile.c:5451:5: call_function: calling ‘append_string_to_mem’ from ‘putlocal’
#  660|         /* realloc a bigger block in 1 K increments */
#  661|         (*blocksize) += bsize;
#  662|->       *pPtr = realloc(*pPtr, *blocksize);
#  663|         if (*pPtr == NULL) {
#  664|           ziperr(ZE_MEM, "append_string_to_mem");

Error: GCC_ANALYZER_WARNING (CWE-126): [#def63]
zip30/zipfile.c:701:18: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5330:10: branch_false: following ‘false’ branch...
zip30/zipfile.c:5387:7: branch_false: ...to here
zip30/zipfile.c:5387:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5389:5: branch_true: ...to here
zip30/zipfile.c:5389:5: call_function: calling ‘add_local_zip64_extra_field’ from ‘putlocal’
zip30/zipfile.c:5389:5: return_function: returning to ‘putlocal’ from ‘add_local_zip64_extra_field’
zip30/zipfile.c:5400:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5402:9: branch_true: ...to here
zip30/zipfile.c:5402:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5406:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5412:7: branch_false: ...to here
zip30/zipfile.c:5412:7: call_function: calling ‘add_Unicode_Path_local_extra_field’ from ‘putlocal’
#  699|     for (pTemp = pExtra; pTemp < pExtra  + iExtraLen - ZIP_EF_HEADER_SIZE;)
#  700|     {
#  701|->     usBlockTag = SH(pTemp);       /* get tag */
#  702|       usBlockSize = SH(pTemp + 2);  /* get field data size */
#  703|       if (usBlockTag == tag)

Error: GCC_ANALYZER_WARNING (CWE-126): [#def64]
zip30/zipfile.c:702:19: warning[-Wanalyzer-out-of-bounds]: heap-based buffer over-read
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5330:10: branch_false: following ‘false’ branch...
zip30/zipfile.c:5387:7: branch_false: ...to here
zip30/zipfile.c:5387:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5389:5: branch_true: ...to here
zip30/zipfile.c:5389:5: call_function: calling ‘add_local_zip64_extra_field’ from ‘putlocal’
zip30/zipfile.c:5389:5: return_function: returning to ‘putlocal’ from ‘add_local_zip64_extra_field’
zip30/zipfile.c:5400:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5402:9: branch_true: ...to here
zip30/zipfile.c:5402:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5406:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5412:7: branch_false: ...to here
zip30/zipfile.c:5412:7: call_function: calling ‘add_Unicode_Path_local_extra_field’ from ‘putlocal’
#  700|     {
#  701|       usBlockTag = SH(pTemp);       /* get tag */
#  702|->     usBlockSize = SH(pTemp + 2);  /* get field data size */
#  703|       if (usBlockTag == tag)
#  704|         return pTemp;

Error: CPPCHECK_WARNING (CWE-476): [#def65]
zip30/zipfile.c:1359: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pZ64Extra
# 1357|           ziperr( ZE_MEM, "Zip64 Extra Field" );
# 1358|         /* move old extra field and update pointer and length */
# 1359|->       memmove( pZ64Extra, pZEntry->extra, pZEntry->ext);
# 1360|         free( pZEntry->extra );
# 1361|         pZEntry->extra = pZ64Extra;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def66]
zip30/zipfile.c:1359:7: warning[-Wanalyzer-null-argument]: use of NULL ‘pZ64Extra’ where non-null expected
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5387:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5389:5: branch_true: ...to here
zip30/zipfile.c:5389:5: call_function: calling ‘add_local_zip64_extra_field’ from ‘putlocal’
# 1357|           ziperr( ZE_MEM, "Zip64 Extra Field" );
# 1358|         /* move old extra field and update pointer and length */
# 1359|->       memmove( pZ64Extra, pZEntry->extra, pZEntry->ext);
# 1360|         free( pZEntry->extra );
# 1361|         pZEntry->extra = pZ64Extra;

Error: CPPCHECK_WARNING (CWE-476): [#def67]
zip30/zipfile.c:1387: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pTemp
# 1385|           usTemp = (extent) (pOldZ64Extra - pZEntry->extra);
# 1386|           pTemp = pZ64Extra;
# 1387|->         memcpy( pTemp, pZEntry->extra, usTemp );
# 1388|           /* move all after old Zip64 EF */
# 1389|           pTemp = pZ64Extra + usTemp;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def68]
zip30/zipfile.c:1387:9: warning[-Wanalyzer-null-argument]: use of NULL ‘pZ64Extra’ where non-null expected
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5387:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5389:5: branch_true: ...to here
zip30/zipfile.c:5389:5: call_function: calling ‘add_local_zip64_extra_field’ from ‘putlocal’
# 1385|           usTemp = (extent) (pOldZ64Extra - pZEntry->extra);
# 1386|           pTemp = pZ64Extra;
# 1387|->         memcpy( pTemp, pZEntry->extra, usTemp );
# 1388|           /* move all after old Zip64 EF */
# 1389|           pTemp = pZ64Extra + usTemp;

Error: CPPCHECK_WARNING (CWE-682): [#def69]
zip30/zipfile.c:1389: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1387|           memcpy( pTemp, pZEntry->extra, usTemp );
# 1388|           /* move all after old Zip64 EF */
# 1389|->         pTemp = pZ64Extra + usTemp;
# 1390|           pOldTemp = pOldZ64Extra + ZIP_EF_HEADER_SIZE + blocksize;
# 1391|           usTemp = pZEntry->ext - usTemp - blocksize;

Error: CPPCHECK_WARNING (CWE-682): [#def70]
zip30/zipfile.c:1403: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1401|     /* set/update zip64 extra field members */
# 1402|     write_ushort_to_mem(ZIP64_EF_TAG, pZ64Extra);
# 1403|->   write_ushort_to_mem((ush) (Z64LocalLen - ZIP_EF_HEADER_SIZE), pZ64Extra + 2);
# 1404|     write_int64_to_mem(pZEntry->len, pZ64Extra + 2 + 2);
# 1405|     write_int64_to_mem(pZEntry->siz, pZ64Extra + 2 + 2 + 8);

Error: CPPCHECK_WARNING (CWE-682): [#def71]
zip30/zipfile.c:1404: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1402|     write_ushort_to_mem(ZIP64_EF_TAG, pZ64Extra);
# 1403|     write_ushort_to_mem((ush) (Z64LocalLen - ZIP_EF_HEADER_SIZE), pZ64Extra + 2);
# 1404|->   write_int64_to_mem(pZEntry->len, pZ64Extra + 2 + 2);
# 1405|     write_int64_to_mem(pZEntry->siz, pZ64Extra + 2 + 2 + 8);
# 1406|   

Error: CPPCHECK_WARNING (CWE-682): [#def72]
zip30/zipfile.c:1405: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1403|     write_ushort_to_mem((ush) (Z64LocalLen - ZIP_EF_HEADER_SIZE), pZ64Extra + 2);
# 1404|     write_int64_to_mem(pZEntry->len, pZ64Extra + 2 + 2);
# 1405|->   write_int64_to_mem(pZEntry->siz, pZ64Extra + 2 + 2 + 8);
# 1406|   
# 1407|     return ZE_OK;

Error: CPPCHECK_WARNING (CWE-476): [#def73]
zip30/zipfile.c:1459: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pUExtra
# 1457|           ziperr( ZE_MEM, "UTF-8 Path Extra Field" );
# 1458|         /* move old extra field and update pointer and length */
# 1459|->       memmove( pUExtra, pZEntry->extra, pZEntry->ext);
# 1460|         free( pZEntry->extra );
# 1461|         pZEntry->extra = pUExtra;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def74]
zip30/zipfile.c:1459:7: warning[-Wanalyzer-null-argument]: use of NULL ‘pUExtra’ where non-null expected
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5387:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:5400:7: branch_false: ...to here
zip30/zipfile.c:5400:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5402:9: branch_true: ...to here
zip30/zipfile.c:5402:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5406:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5412:7: branch_false: ...to here
zip30/zipfile.c:5412:7: call_function: calling ‘add_Unicode_Path_local_extra_field’ from ‘putlocal’
# 1457|           ziperr( ZE_MEM, "UTF-8 Path Extra Field" );
# 1458|         /* move old extra field and update pointer and length */
# 1459|->       memmove( pUExtra, pZEntry->extra, pZEntry->ext);
# 1460|         free( pZEntry->extra );
# 1461|         pZEntry->extra = pUExtra;

Error: CPPCHECK_WARNING (CWE-476): [#def75]
zip30/zipfile.c:1487: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pTemp
# 1485|           usTemp = (extent) (pOldUExtra - pZEntry->extra);
# 1486|           pTemp = pUExtra;
# 1487|->         memcpy( pTemp, pZEntry->extra, usTemp );
# 1488|           /* move all after old UTF-8 Path EF */
# 1489|           pTemp = pUExtra + usTemp;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def76]
zip30/zipfile.c:1487:9: warning[-Wanalyzer-null-argument]: use of NULL ‘pUExtra’ where non-null expected
zip30/zipfile.c:5271:5: enter_function: entry to ‘putlocal’
zip30/zipfile.c:5387:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:5400:7: branch_false: ...to here
zip30/zipfile.c:5400:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5402:9: branch_true: ...to here
zip30/zipfile.c:5402:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5406:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5412:7: branch_false: ...to here
zip30/zipfile.c:5412:7: call_function: calling ‘add_Unicode_Path_local_extra_field’ from ‘putlocal’
# 1485|           usTemp = (extent) (pOldUExtra - pZEntry->extra);
# 1486|           pTemp = pUExtra;
# 1487|->         memcpy( pTemp, pZEntry->extra, usTemp );
# 1488|           /* move all after old UTF-8 Path EF */
# 1489|           pTemp = pUExtra + usTemp;

Error: CPPCHECK_WARNING (CWE-682): [#def77]
zip30/zipfile.c:1489: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1487|           memcpy( pTemp, pZEntry->extra, usTemp );
# 1488|           /* move all after old UTF-8 Path EF */
# 1489|->         pTemp = pUExtra + usTemp;
# 1490|           pOldTemp = pOldUExtra + ZIP_EF_HEADER_SIZE + blocksize;
# 1491|           usTemp = pZEntry->ext - usTemp - blocksize;

Error: CPPCHECK_WARNING (CWE-682): [#def78]
zip30/zipfile.c:1537: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1535|     write_ushort_to_mem(UTF8_PATH_EF_TAG, pUExtra);
# 1536|     /* data size */
# 1537|->   write_ushort_to_mem((ush) (ULocalLen - ZIP_EF_HEADER_SIZE), pUExtra + 2);
# 1538|     /* version */
# 1539|     *(pUExtra + 2 + 2) = 1;

Error: CPPCHECK_WARNING (CWE-682): [#def79]
zip30/zipfile.c:1539: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1537|     write_ushort_to_mem((ush) (ULocalLen - ZIP_EF_HEADER_SIZE), pUExtra + 2);
# 1538|     /* version */
# 1539|->   *(pUExtra + 2 + 2) = 1;
# 1540|     /* iname chksum */
# 1541|     write_ulong_to_mem(chksum, pUExtra + 2 + 2 + 1);

Error: CPPCHECK_WARNING (CWE-682): [#def80]
zip30/zipfile.c:1541: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1539|     *(pUExtra + 2 + 2) = 1;
# 1540|     /* iname chksum */
# 1541|->   write_ulong_to_mem(chksum, pUExtra + 2 + 2 + 1);
# 1542|     /* UTF-8 path */
# 1543|     write_string_to_mem(pZEntry->uname, pUExtra + 2 + 2 + 1 + 4);

Error: CPPCHECK_WARNING (CWE-682): [#def81]
zip30/zipfile.c:1543: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1541|     write_ulong_to_mem(chksum, pUExtra + 2 + 2 + 1);
# 1542|     /* UTF-8 path */
# 1543|->   write_string_to_mem(pZEntry->uname, pUExtra + 2 + 2 + 1 + 4);
# 1544|   
# 1545|     return ZE_OK;

Error: CPPCHECK_WARNING (CWE-476): [#def82]
zip30/zipfile.c:1591: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pUExtra
# 1589|           ziperr( ZE_MEM, "UTF-8 Path Extra Field" );
# 1590|         /* move old extra field and update pointer and length */
# 1591|->       memmove( pUExtra, pZEntry->cextra, pZEntry->cext);
# 1592|         free( pZEntry->cextra );
# 1593|         pZEntry->cextra = pUExtra;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def83]
zip30/zipfile.c:1591:7: warning[-Wanalyzer-null-argument]: use of NULL ‘pUExtra’ where non-null expected
zip30/zipfile.c:5610:5: enter_function: entry to ‘putcentral’
zip30/zipfile.c:5643:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5644:9: branch_true: ...to here
zip30/zipfile.c:5647:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5652:7: branch_false: ...to here
zip30/zipfile.c:5652:7: call_function: calling ‘add_Unicode_Path_cen_extra_field’ from ‘putcentral’
# 1589|           ziperr( ZE_MEM, "UTF-8 Path Extra Field" );
# 1590|         /* move old extra field and update pointer and length */
# 1591|->       memmove( pUExtra, pZEntry->cextra, pZEntry->cext);
# 1592|         free( pZEntry->cextra );
# 1593|         pZEntry->cextra = pUExtra;

Error: CPPCHECK_WARNING (CWE-476): [#def84]
zip30/zipfile.c:1619: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: pTemp
# 1617|           usTemp = (extent) (pOldUExtra - pZEntry->cextra);
# 1618|           pTemp = pUExtra;
# 1619|->         memcpy( pTemp, pZEntry->cextra, usTemp );
# 1620|           /* move all after old UTF-8 Path EF */
# 1621|           pTemp = pUExtra + usTemp;

Error: GCC_ANALYZER_WARNING (CWE-688): [#def85]
zip30/zipfile.c:1619:9: warning[-Wanalyzer-null-argument]: use of NULL ‘pUExtra’ where non-null expected
zip30/zipfile.c:5610:5: enter_function: entry to ‘putcentral’
zip30/zipfile.c:5643:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:5644:9: branch_true: ...to here
zip30/zipfile.c:5647:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:5652:7: branch_false: ...to here
zip30/zipfile.c:5652:7: call_function: calling ‘add_Unicode_Path_cen_extra_field’ from ‘putcentral’
# 1617|           usTemp = (extent) (pOldUExtra - pZEntry->cextra);
# 1618|           pTemp = pUExtra;
# 1619|->         memcpy( pTemp, pZEntry->cextra, usTemp );
# 1620|           /* move all after old UTF-8 Path EF */
# 1621|           pTemp = pUExtra + usTemp;

Error: CPPCHECK_WARNING (CWE-682): [#def86]
zip30/zipfile.c:1621: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1619|           memcpy( pTemp, pZEntry->cextra, usTemp );
# 1620|           /* move all after old UTF-8 Path EF */
# 1621|->         pTemp = pUExtra + usTemp;
# 1622|           pOldTemp = pOldUExtra + ZIP_EF_HEADER_SIZE + blocksize;
# 1623|           usTemp = pZEntry->cext - usTemp - blocksize;

Error: CPPCHECK_WARNING (CWE-682): [#def87]
zip30/zipfile.c:1672: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1670|     write_ushort_to_mem(UTF8_PATH_EF_TAG, pUExtra);
# 1671|     /* data size */
# 1672|->   write_ushort_to_mem((ush) (UCenLen - ZIP_EF_HEADER_SIZE), pUExtra + 2);
# 1673|     /* version */
# 1674|     *(pUExtra + 2 + 2) = 1;

Error: CPPCHECK_WARNING (CWE-682): [#def88]
zip30/zipfile.c:1674: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1672|     write_ushort_to_mem((ush) (UCenLen - ZIP_EF_HEADER_SIZE), pUExtra + 2);
# 1673|     /* version */
# 1674|->   *(pUExtra + 2 + 2) = 1;
# 1675|     /* iname checksum */
# 1676|     write_ulong_to_mem(chksum, pUExtra + 2 + 2 + 1);

Error: CPPCHECK_WARNING (CWE-682): [#def89]
zip30/zipfile.c:1676: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1674|     *(pUExtra + 2 + 2) = 1;
# 1675|     /* iname checksum */
# 1676|->   write_ulong_to_mem(chksum, pUExtra + 2 + 2 + 1);
# 1677|     /* UTF-8 path */
# 1678|     write_string_to_mem(pZEntry->uname, pUExtra + 2 + 2 + 1 + 4);

Error: CPPCHECK_WARNING (CWE-682): [#def90]
zip30/zipfile.c:1678: error[nullPointerArithmeticOutOfMemory]: If memory allocation fails: pointer addition with NULL pointer.
# 1676|     write_ulong_to_mem(chksum, pUExtra + 2 + 2 + 1);
# 1677|     /* UTF-8 path */
# 1678|->   write_string_to_mem(pZEntry->uname, pUExtra + 2 + 2 + 1 + 4);
# 1679|   
# 1680|     return ZE_OK;

Error: COMPILER_WARNING: [#def91]
zip30/zipfile.c: scope_hint: In function ‘ffile_size’
zip30/zipfile.c:1696:10: warning[-Wunused-but-set-variable=]: variable ‘siz’ set but not used
# 1696 |   size_t siz;
#      |          ^~~
# 1694|   {
# 1695|     int sts;
# 1696|->   size_t siz;
# 1697|     zoff_t ofs;
# 1698|     char waste[ 4];

Error: COMPILER_WARNING: [#def92]
zip30/zipfile.c: scope_hint: In function ‘readlocal’
zip30/zipfile.c:2168:11: warning[-Wunused-but-set-variable=]: variable ‘start_offset’ set but not used
# 2168 |   uzoff_t start_offset = 0;
#      |           ^~~~~~~~~~~~
# 2166|   #ifndef UTIL
# 2167|     ulg start_disk = 0;
# 2168|->   uzoff_t start_offset = 0;
# 2169|     char *split_path;
# 2170|   

Error: COMPILER_WARNING: [#def93]
zip30/zipfile.c:3223:11: warning[-Wunused-but-set-variable=]: variable ‘cd_total_entries’ set but not used
# 3223 |   uzoff_t cd_total_entries = 0; /* number of entries according to EOCDR */
#      |           ^~~~~~~~~~~~~~~~
# 3221|     int in_central_directory = 0; /* found a central directory record */
# 3222|     struct zlist far *cz;
# 3223|->   uzoff_t cd_total_entries = 0; /* number of entries according to EOCDR */
# 3224|     ulg     in_cd_start_disk;     /* central directory start disk */
# 3225|     uzoff_t in_cd_start_offset;   /* offset of start of cd on cd start disk */

Error: COMPILER_WARNING: [#def94]
zip30/zipfile.c: scope_hint: In function ‘scanzipf_fixnew’
zip30/zipfile.c:3225:11: warning[-Wunused-but-set-variable=]: variable ‘in_cd_start_offset’ set but not used
# 3225 |   uzoff_t in_cd_start_offset;   /* offset of start of cd on cd start disk */
#      |           ^~~~~~~~~~~~~~~~~~
# 3223|     uzoff_t cd_total_entries = 0; /* number of entries according to EOCDR */
# 3224|     ulg     in_cd_start_disk;     /* central directory start disk */
# 3225|->   uzoff_t in_cd_start_offset;   /* offset of start of cd on cd start disk */
# 3226|   
# 3227|   

Error: COMPILER_WARNING (CWE-457): [#def95]
zip30/zipfile.c: scope_hint: In function ‘scanzipf_fixnew’
zip30/zipfile.c:3638:14: warning[-Wmaybe-uninitialized]: ‘x’ may be used uninitialized
# 3638 |           *x = z;
#      |           ~~~^~~
zip30/zipfile.c:3217:27: note: ‘x’ was declared here
# 3217 |   struct zlist far * far *x;  /* pointer last entry's link */
#      |                           ^
# 3636|               x = &zfiles;
# 3637|             /* Link into list */
# 3638|->           *x = z;
# 3639|             z->nxt = NULL;
# 3640|             x = &z->nxt;

Error: COMPILER_WARNING: [#def96]
zip30/zipfile.c:4029:11: warning[-Wunused-but-set-variable=]: variable ‘z64eocdr_size’ set but not used
# 4029 |   uzoff_t z64eocdr_size;
#      |           ^~~~~~~~~~~~~
# 4027|     ulg     z64eocdr_disk;
# 4028|     uzoff_t z64eocdr_offset;
# 4029|->   uzoff_t z64eocdr_size;
# 4030|     ush     version_made;
# 4031|     ush     version_needed = 0;

Error: COMPILER_WARNING: [#def97]
zip30/zipfile.c: scope_hint: In function ‘scanzipf_regnew’
zip30/zipfile.c:4030:11: warning[-Wunused-but-set-variable=]: variable ‘version_made’ set but not used
# 4030 |   ush     version_made;
#      |           ^~~~~~~~~~~~
# 4028|     uzoff_t z64eocdr_offset;
# 4029|     uzoff_t z64eocdr_size;
# 4030|->   ush     version_made;
# 4031|     ush     version_needed = 0;
# 4032|     zoff_t zip64_eocdr_start;

Error: COMPILER_WARNING (CWE-457): [#def98]
zip30/zipfile.c:5057:10: warning[-Wmaybe-uninitialized]: ‘x’ may be used uninitialized
# 5057 |       *x = z;
#      |       ~~~^~~
zip30/zipfile.c: scope_hint: In function ‘readzipfile’
zip30/zipfile.c:4049:27: note: ‘x’ was declared here
# 4049 |   struct zlist far * far *x;  /* pointer last entry's link */
#      |                           ^
# 5055|   
# 5056|         /* Link into list */
# 5057|->       *x = z;
# 5058|         z->nxt = NULL;
# 5059|         x = &z->nxt;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def99]
zip30/zipfile.c:5404:7: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*z.flg’
zip30/zipfile.c:6003:5: enter_function: entry to ‘zipcopy’
zip30/zipfile.c:6067:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:6075:7: branch_false: ...to here
zip30/zipfile.c:6083:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6108:37: branch_false: ...to here
zip30/zipfile.c:6108:6: branch_false: following ‘false’ branch (when ‘localz’ is non-NULL)...
zip30/zipfile.c:6115:17: branch_false: ...to here
zip30/zipfile.c:6173:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:7: branch_false: ...to here
zip30/zipfile.c:6180:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6182:3: branch_false: ...to here
zip30/zipfile.c:6185:17: call_function: calling ‘adjust_zip_local_entry’ from ‘zipcopy’
zip30/zipfile.c:6185:17: return_function: returning to ‘zipcopy’ from ‘adjust_zip_local_entry’
zip30/zipfile.c:6189:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6191:19: branch_true: ...to here
zip30/zipfile.c:6194:8: branch_true: following ‘true’ branch...
zip30/zipfile.c:6195:11: branch_true: ...to here
zip30/zipfile.c:6195:10: branch_true: following ‘true’ branch...
zip30/zipfile.c:6198:9: branch_true: ...to here
zip30/zipfile.c:6200:12: branch_false: following ‘false’ branch...
zip30/zipfile.c:6208:11: branch_false: ...to here
zip30/zipfile.c:6229:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6241:14: branch_true: ...to here
zip30/zipfile.c:6296:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6310:3: branch_false: ...to here
zip30/zipfile.c:6325:7: branch_false: following ‘false’ branch...
zip30/zipfile.c:6332:7: branch_false: ...to here
zip30/zipfile.c:6347:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6363:7: branch_false: ...to here
zip30/zipfile.c:6363:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6364:14: branch_true: ...to here
zip30/zipfile.c:6368:7: call_function: calling ‘putlocal’ from ‘zipcopy’
# 5402|       if (utf8_force || using_utf8) {
# 5403|         z->lflg |= UTF8_BIT;
# 5404|->       z->flg |= UTF8_BIT;
# 5405|       }
# 5406|       if (z->flg & UTF8_BIT) {

Error: GCC_ANALYZER_WARNING (CWE-457): [#def100]
zip30/zipfile.c:5406:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*z.flg’
zip30/zipfile.c:6003:5: enter_function: entry to ‘zipcopy’
zip30/zipfile.c:6067:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:6075:7: branch_false: ...to here
zip30/zipfile.c:6083:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6108:37: branch_false: ...to here
zip30/zipfile.c:6108:6: branch_false: following ‘false’ branch (when ‘localz’ is non-NULL)...
zip30/zipfile.c:6115:17: branch_false: ...to here
zip30/zipfile.c:6173:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:7: branch_false: ...to here
zip30/zipfile.c:6180:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6182:3: branch_false: ...to here
zip30/zipfile.c:6185:17: call_function: calling ‘adjust_zip_local_entry’ from ‘zipcopy’
zip30/zipfile.c:6185:17: return_function: returning to ‘zipcopy’ from ‘adjust_zip_local_entry’
zip30/zipfile.c:6189:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6191:19: branch_true: ...to here
zip30/zipfile.c:6194:8: branch_true: following ‘true’ branch...
zip30/zipfile.c:6195:11: branch_true: ...to here
zip30/zipfile.c:6195:10: branch_true: following ‘true’ branch...
zip30/zipfile.c:6198:9: branch_true: ...to here
zip30/zipfile.c:6200:12: branch_false: following ‘false’ branch...
zip30/zipfile.c:6208:11: branch_false: ...to here
zip30/zipfile.c:6229:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6241:14: branch_true: ...to here
zip30/zipfile.c:6296:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6310:3: branch_false: ...to here
zip30/zipfile.c:6325:7: branch_false: following ‘false’ branch...
zip30/zipfile.c:6332:7: branch_false: ...to here
zip30/zipfile.c:6347:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6363:7: branch_false: ...to here
zip30/zipfile.c:6363:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6364:14: branch_true: ...to here
zip30/zipfile.c:6368:7: call_function: calling ‘putlocal’ from ‘zipcopy’
# 5404|         z->flg |= UTF8_BIT;
# 5405|       }
# 5406|->     if (z->flg & UTF8_BIT) {
# 5407|         /* If this flag is set, then restore UTF-8 as path name */
# 5408|         use_uname = 1;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def101]
zip30/zipfile.c:5416:5: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*z.flg’
zip30/zipfile.c:6003:5: enter_function: entry to ‘zipcopy’
zip30/zipfile.c:6067:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:6075:7: branch_false: ...to here
zip30/zipfile.c:6083:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6108:37: branch_false: ...to here
zip30/zipfile.c:6108:6: branch_false: following ‘false’ branch (when ‘localz’ is non-NULL)...
zip30/zipfile.c:6115:17: branch_false: ...to here
zip30/zipfile.c:6173:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6176:7: branch_false: ...to here
zip30/zipfile.c:6180:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6182:3: branch_false: ...to here
zip30/zipfile.c:6185:17: call_function: calling ‘adjust_zip_local_entry’ from ‘zipcopy’
zip30/zipfile.c:6185:17: return_function: returning to ‘zipcopy’ from ‘adjust_zip_local_entry’
zip30/zipfile.c:6229:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6241:14: branch_true: ...to here
zip30/zipfile.c:6296:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6310:3: branch_false: ...to here
zip30/zipfile.c:6325:7: branch_false: following ‘false’ branch...
zip30/zipfile.c:6332:7: branch_false: ...to here
zip30/zipfile.c:6363:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6364:14: branch_true: ...to here
zip30/zipfile.c:6368:7: call_function: calling ‘putlocal’ from ‘zipcopy’
# 5414|     } else {
# 5415|       /* clear UTF-8 bit as not needed */
# 5416|->     z->flg &= ~UTF8_BIT;
# 5417|       z->lflg &= ~UTF8_BIT;
# 5418|     }

Error: COMPILER_WARNING: [#def102]
zip30/zipfile.c: scope_hint: In function ‘putend’
zip30/zipfile.c:5826:7: warning[-Wunused-but-set-variable=]: variable ‘iNeedZip64’ set but not used
# 5826 |   int iNeedZip64 = 0;
#      |       ^~~~~~~~~~
# 5824|   #ifdef ZIP64_SUPPORT        /* zip64 support 09/05/2003 R.Nausedat */
# 5825|     ush vem;          /* version made by */
# 5826|->   int iNeedZip64 = 0;
# 5827|   
# 5828|     char *block = NULL;   /* mem block to write to */

Error: GCC_ANALYZER_WARNING (CWE-401): [#def103]
zip30/zipfile.c:6536:1: warning[-Wanalyzer-malloc-leak]: leak of ‘<unknown>’
zip30/zipfile.c:6067:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:6075:7: branch_false: ...to here
zip30/zipfile.c:6083:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6108:37: branch_false: ...to here
zip30/zipfile.c:6108:6: branch_false: following ‘false’ branch (when ‘localz’ is non-NULL)...
zip30/zipfile.c:6115:17: branch_false: ...to here
zip30/zipfile.c:6173:24: acquire_memory: allocated here
zip30/zipfile.c:6173:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6173:7: branch_false: ...to here
zip30/zipfile.c:6173:7: branch_true: following ‘true’ branch...
zip30/zipfile.c:6174:40: branch_true: ...to here
zip30/zipfile.c:6174:7: branch_true: following ‘true’ branch...
zip30/zipfile.c:6057:18: branch_true: ...to here
zip30/zipfile.c:6536:1: danger: ‘<unknown>’ leaks here; was allocated at [(7)](sarif:/runs/0/results/19/codeFlows/0/threadFlows/0/locations/6)
# 6534|   
# 6535|     return r;
# 6536|-> }
# 6537|   
# 6538|   

Error: GCC_ANALYZER_WARNING (CWE-401): [#def104]
zip30/zipfile.c:6536:1: warning[-Wanalyzer-malloc-leak]: leak of ‘localz’
zip30/zipfile.c:6067:8: branch_false: following ‘false’ branch...
zip30/zipfile.c:6075:7: branch_false: ...to here
zip30/zipfile.c:6083:6: branch_false: following ‘false’ branch...
zip30/zipfile.c:6108:37: branch_false: ...to here
zip30/zipfile.c:6108:37: acquire_memory: allocated here
zip30/zipfile.c:6108:6: branch_false: following ‘false’ branch (when ‘localz’ is non-NULL)...
zip30/zipfile.c:6115:17: branch_false: ...to here
zip30/zipfile.c:6173:6: branch_true: following ‘true’ branch...
zip30/zipfile.c:6057:18: branch_true: ...to here
zip30/zipfile.c:6536:1: danger: ‘localz’ leaks here; was allocated at [(5)](sarif:/runs/0/results/20/codeFlows/0/threadFlows/0/locations/4)
# 6534|   
# 6535|     return r;
# 6536|-> }
# 6537|   
# 6538|   

Error: CPPCHECK_WARNING (CWE-476): [#def105]
zip30/zipnote.c:598: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: zcomment
#  596|     if (a != NULL)                        /* change zip file comment */
#  597|     {
#  598|->     zcomment = malloc(1);  *zcomment = 0;
#  599|       while ((a = zgetline(abf, WRBUFSIZ+1)) != NULL)
#  600|         if ((r = catalloc(&zcomment, a)) != ZE_OK)

Error: GCC_ANALYZER_WARNING (CWE-476): [#def106]
zip30/zipnote.c:598:28: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘zcomment’
zip30/zipnote.c:384:5: enter_function: entry to ‘main’
zip30/zipnote.c:444:6: branch_false: following ‘false’ branch (when ‘argc != 1’)...
zip30/zipnote.c:451:3: branch_false: ...to here
zip30/zipnote.c:478:15: branch_true: following ‘true’ branch (when ‘r < argc’)...
zip30/zipnote.c:479:14: branch_true: ...to here
zip30/zipnote.c:480:10: branch_true: following ‘true’ branch...
zip30/zipnote.c:481:14: branch_true: ...to here
zip30/zipnote.c:481:29: branch_false: following ‘false’ branch...
zip30/zipnote.c:478:25: branch_false: ...to here
zip30/zipnote.c:521:6: branch_false: following ‘false’ branch...
zip30/zipnote.c:524:25: branch_false: ...to here
zip30/zipnote.c:524:6: branch_false: following ‘false’ branch...
zip30/zipnote.c:527:3: branch_false: ...to here
zip30/zipnote.c:530:6: branch_false: following ‘false’ branch...
zip30/zipnote.c:532:7: branch_false: ...to here
zip30/zipnote.c:532:6: branch_false: following ‘false’ branch...
zip30/zipnote.c:536:6: branch_false: ...to here
zip30/zipnote.c:536:6: branch_false: following ‘false’ branch (when ‘w != 0’)...
zip30/zipnote.c:550:12: branch_false: ...to here
zip30/zipnote.c:550:6: branch_false: following ‘false’ branch...
zip30/zipnote.c:552:3: branch_false: ...to here
zip30/zipnote.c:557:15: call_function: calling ‘zgetline’ from ‘main’
zip30/zipnote.c:557:15: return_function: returning to ‘main’ from ‘zgetline’
zip30/zipnote.c:557:10: branch_true: following ‘true’ branch...
zip30/zipnote.c:558:11: branch_true: ...to here
zip30/zipnote.c:557:10: branch_false: following ‘false’ branch...
zip30/zipnote.c:558:34: branch_false: ...to here
zip30/zipnote.c:558:10: branch_false: following ‘false’ branch (when the strings are equal)...
zip30/zipnote.c:596:6: branch_false: ...to here
zip30/zipnote.c:596:6: branch_true: following ‘true’ branch...
zip30/zipnote.c:598:16: branch_true: ...to here
zip30/zipnote.c:598:16: acquire_memory: this call could return NULL
zip30/zipnote.c:598:28: danger: ‘malloc(1)’ could be NULL: unchecked value from [(35)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/34)
#  596|     if (a != NULL)                        /* change zip file comment */
#  597|     {
#  598|->     zcomment = malloc(1);  *zcomment = 0;
#  599|       while ((a = zgetline(abf, WRBUFSIZ+1)) != NULL)
#  600|         if ((r = catalloc(&zcomment, a)) != ZE_OK)

Error: GCC_ANALYZER_WARNING (CWE-415): [#def107]
zip30/zipsplit.c:220:5: warning[-Wanalyzer-double-free]: double-‘free’ of ‘p’
zip30/zipsplit.c:502:5: enter_function: entry to ‘main’
zip30/zipsplit.c:578:6: branch_false: following ‘false’ branch (when ‘argc != 1’)...
zip30/zipsplit.c:585:3: branch_false: ...to here
zip30/zipsplit.c:689:6: branch_false: following ‘false’ branch...
zip30/zipsplit.c:692:25: branch_false: ...to here
zip30/zipsplit.c:692:6: branch_false: following ‘false’ branch...
zip30/zipsplit.c:695:3: branch_false: ...to here
zip30/zipsplit.c:698:6: branch_false: following ‘false’ branch...
zip30/zipsplit.c:700:7: branch_false: ...to here
zip30/zipsplit.c:700:6: branch_false: following ‘false’ branch...
zip30/zipsplit.c:705:3: branch_false: ...to here
zip30/zipsplit.c:706:23: call_function: inlined call to ‘talloc’ from ‘main’
zip30/zipsplit.c:707:33: call_function: inlined call to ‘talloc’ from ‘main’
zip30/zipsplit.c:710:5: branch_false: ...to here
zip30/zipsplit.c:710:5: call_function: calling ‘ziperr’ from ‘main’
#  218|   {
#  219|     while (talln)
#  220|->     free(talls[--talln]);
#  221|   }
#  222|   

Error: COMPILER_WARNING (CWE-252): [#def108]
zip30/zipsplit.c: scope_hint: In function ‘retry’
zip30/zipsplit.c:496:3: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
#  496 |   fgets(m, 10, stdin);
#      |   ^~~~~~~~~~~~~~~~~~~
#  494|     char m[10];
#  495|     fputs("Error writing to disk--redo entire disk? ", mesg);
#  496|->   fgets(m, 10, stdin);
#  497|     return *m == 'y' || *m == 'Y';
#  498|   }

Error: COMPILER_WARNING (CWE-252): [#def109]
zip30/zipsplit.c: scope_hint: In function ‘main’
zip30/zipsplit.c:884:7: warning[-Wunused-result]: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’
#  884 |       fgets(m, 10, stdin);
#      |       ^~~~~~~~~~~~~~~~~~~
#  882|         fprintf(mesg, "Insert disk #%ld of %ld and hit return: ",
#  883|                 (ulg)j + 1, (ulg)s);
#  884|->       fgets(m, 10, stdin);
#  885|       }
#  886|   

Error: CPPCHECK_WARNING (CWE-908): [#def110]
zip30/zipsplit.c:905: error[useClosedFile]: Used file that is not opened.
#  903|         {
#  904|           if (j)
#  905|->           fclose(f);
#  906|           if (u && retry()) goto redobin;
#  907|           ziperr(ZE_WRITE, path);

Error: COMPILER_WARNING: [#def111]
zip30/zipup.c: scope_hint: In function ‘zipup’
zip30/zipup.c:403:17: warning[-Wunused-but-set-variable=]: variable ‘p’ set but not used
#  403 |   zoff_t o = 0, p;      /* offsets in zip file */
#      |                 ^
#  401|     int m;                /* method for this entry */
#  402|   
#  403|->   zoff_t o = 0, p;      /* offsets in zip file */
#  404|     zoff_t q = (zoff_t) -3; /* size returned by filetime */
#  405|     uzoff_t uq;           /* unsigned q */

Error: GCC_ANALYZER_WARNING (CWE-688): [#def112]
zip30/zipup.c:488:7: warning[-Wanalyzer-null-argument]: use of NULL ‘tempextra’ where non-null expected
zip30/zipup.c:441:6: branch_false: following ‘false’ branch...
zip30/zipup.c:445:6: branch_true: following ‘true’ branch...
zip30/zipup.c:447:6: branch_true: ...to here
zip30/zipup.c:457:8: branch_true: following ‘true’ branch...
zip30/zipup.c:457:8: branch_true: ...to here
zip30/zipup.c:481:6: branch_true: following ‘true’ branch...
zip30/zipup.c:484:9: branch_true: ...to here
zip30/zipup.c:484:8: branch_true: following ‘true’ branch...
zip30/zipup.c:485:24: branch_true: ...to here
zip30/zipup.c:485:24: acquire_memory: allocated here
zip30/zipup.c:485:10: release_memory: assuming ‘tempextra’ is NULL
zip30/zipup.c:485:10: branch_true: following ‘true’ branch (when ‘tempextra’ is NULL)...
zip30/zipup.c:486:9: branch_true: ...to here
zip30/zipup.c:488:7: danger: argument 1 (‘tempextra’) NULL where non-null expected
#  486|           ZIPERR(ZE_MEM, "extra fields copy");
#  487|         }
#  488|->       memcpy(tempextra, z->extra, z->ext);
#  489|         tempext = z->ext;
#  490|       }

Error: CPPCHECK_WARNING (CWE-401): [#def113]
zip30/zipup.c:610: error[memleak]: Memory leak: tempcextra
#  608|   #else
#  609|         if ((ifile = zopen(z->name, fhow)) == fbad)
#  610|->         return ZE_OPEN;
#  611|   #endif
#  612|       }

Error: CPPCHECK_WARNING (CWE-401): [#def114]
zip30/zipup.c:610: error[memleak]: Memory leak: tempextra
#  608|   #else
#  609|         if ((ifile = zopen(z->name, fhow)) == fbad)
#  610|->         return ZE_OPEN;
#  611|   #endif
#  612|       }

Error: COMPILER_WARNING: [#def115]
zip30/zipup.c: scope_hint: In function ‘bz_compress_init’
zip30/zipup.c:1674:17: warning[-Wunused-but-set-variable=]: variable ‘bzlibVer’ set but not used
# 1674 |     const char *bzlibVer;
#      |                 ^~~~~~~~
# 1672|       int err = BZ_OK;
# 1673|       int zp_err = ZE_OK;
# 1674|->     const char *bzlibVer;
# 1675|   
# 1676|       bzlibVer = BZ2_bzlibVersion();

Scan Properties

analyzer-version-clippy1.97.1
analyzer-version-cppcheck2.21.1
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-163.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namezip-3.0-45.fc44
store-results-to/tmp/tmpc0lg4g59/zip-3.0-45.fc44.tar.xz
time-created2026-08-03 21:58:41
time-finished2026-08-03 22:00:49
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmpc0lg4g59/zip-3.0-45.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpc0lg4g59/zip-3.0-45.fc44.src.rpm'
tool-versioncsmock-3.8.7.20260803.142340.gb75b18e-1.el9