test/sslcorrupttest.c:22: error: NULL_DEREFERENCE
  pointer `next` last assigned on line 20 could be null and is dereferenced by call to `BIO_test_flags()` at line 22, column 13.
Showing all 9 steps of the trace


test/sslcorrupttest.c:17:1: start of procedure copy_flags()
15.   static int docorrupt = 0;
16.   
17. > static void copy_flags(BIO *bio)
18.   {
19.       int flags;

test/sslcorrupttest.c:20:5: 
18.   {
19.       int flags;
20. >     BIO *next = BIO_next(bio);
21.   
22.       flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);

crypto/bio/bio_lib.c:670:1: start of procedure BIO_next()
  668.   }
  669.   
  670. > BIO *BIO_next(BIO *b)
  671.   {
  672.       if (b == NULL)

crypto/bio/bio_lib.c:672:9: Taking true branch
  670.   BIO *BIO_next(BIO *b)
  671.   {
  672.       if (b == NULL)
                 ^
  673.           return NULL;
  674.       return b->next_bio;

crypto/bio/bio_lib.c:673:9: 
  671.   {
  672.       if (b == NULL)
  673. >         return NULL;
  674.       return b->next_bio;
  675.   }

crypto/bio/bio_lib.c:675:1: return from a call to BIO_next
  673.           return NULL;
  674.       return b->next_bio;
  675. > }
  676.   
  677.   void BIO_set_next(BIO *b, BIO *next)

test/sslcorrupttest.c:22:5: 
20.       BIO *next = BIO_next(bio);
21.   
22. >     flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);
23.       BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);
24.       BIO_set_flags(bio, flags);

crypto/bio/bio_lib.c:194:1: start of procedure BIO_test_flags()
  192.   }
  193.   
  194. > int BIO_test_flags(const BIO *b, int flags)
  195.   {
  196.       return (b->flags & flags);

crypto/bio/bio_lib.c:196:5: 
  194.   int BIO_test_flags(const BIO *b, int flags)
  195.   {
  196. >     return (b->flags & flags);
  197.   }
  198.   

static void copy_flags(BIO *bio)
{
    int flags;
    BIO *next = BIO_next(bio);
    flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);
    BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);
    BIO_set_flags(bio, flags);
}
['static void copy_flags(BIO *bio)\n{\n    int flags;\n    BIO *next = BIO_next(bio);\n    flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);\n    BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS);\n    BIO_set_flags(bio, flags);\n}', 'BIO *BIO_next(BIO *b)\n{\n    if (b == NULL)\n        return NULL;\n    return b->next_bio;\n}', 'int BIO_test_flags(const BIO *b, int flags)\n{\n    return (b->flags & flags);\n}']