Task #131532 - fixed.err

back to task #131532
download
Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/cbor_sequence.c: scope_hint: In function ‘read_cbor_sequence’
libcbor-0.13.0/examples/cbor_sequence.c:68:3: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   68 |   fread(buffer, 1, file_size, file);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#   66|     }
#   67|   
#   68|->   fread(buffer, 1, file_size, file);
#   69|     fclose(file);
#   70|   

Error: CPPCHECK_WARNING (CWE-476):
libcbor-0.13.0/examples/readfile.c:29: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   27|     fseek(f, 0, SEEK_SET);
#   28|     unsigned char* buffer = malloc(length);
#   29|->   fread(buffer, length, 1, f);
#   30|   
#   31|     /* Assuming `buffer` contains `length` bytes of input data */

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/readfile.c: scope_hint: In function ‘main’
libcbor-0.13.0/examples/readfile.c:29:3: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   29 |   fread(buffer, length, 1, f);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#   27|     fseek(f, 0, SEEK_SET);
#   28|     unsigned char* buffer = malloc(length);
#   29|->   fread(buffer, length, 1, f);
#   30|   
#   31|     /* Assuming `buffer` contains `length` bytes of input data */

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/streaming_array.c: scope_hint: In function ‘main’
libcbor-0.13.0/examples/streaming_array.c:34:3: warning[-Wunused-result]: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’
#   34 |   scanf(argv[1], "%zu", &n);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
#   32|     if (argc != 2) usage();
#   33|     size_t n;
#   34|->   scanf(argv[1], "%zu", &n);
#   35|     out = freopen(NULL, "wb", stdout);
#   36|     if (!out) exit(1);

Error: CPPCHECK_WARNING (CWE-476):
libcbor-0.13.0/examples/streaming_parser.c:44: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: buffer
#   42|     fseek(f, 0, SEEK_SET);
#   43|     unsigned char* buffer = malloc(length);
#   44|->   fread(buffer, length, 1, f);
#   45|   
#   46|     struct cbor_callbacks callbacks = cbor_empty_callbacks;

Error: COMPILER_WARNING (CWE-252):
libcbor-0.13.0/examples/streaming_parser.c: scope_hint: In function ‘main’
libcbor-0.13.0/examples/streaming_parser.c:44:3: warning[-Wunused-result]: ignoring return value of ‘fread’ declared with attribute ‘warn_unused_result’
#   44 |   fread(buffer, length, 1, f);
#      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
#   42|     fseek(f, 0, SEEK_SET);
#   43|     unsigned char* buffer = malloc(length);
#   44|->   fread(buffer, length, 1, f);
#   45|   
#   46|     struct cbor_callbacks callbacks = cbor_empty_callbacks;