Re: BIO_read() crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

there is an error in your code - see my comment below.


On Mon, 2022-12-05 at 08:45 +0000, Zhongyan Wang wrote:
...
>     md = EVP_get_digestbyname(dgst);
>     if (!md) {
>         printf("Error EVP_get_digestbyname %s\n", dgst);
>         goto err_exit;
>     }
>  
>     in = BIO_new_file(datain, "rb");
>     if (!in) {
>         printf("Error BIO_new_file %s\n", datain);
>         goto err_exit;
>     }
>  
>     out = BIO_new(BIO_s_mem());
>     if (!out) {
>         printf("Error BIO_new out\n");
>         goto err_exit;
>     }
>  
>     rbio = in;
>  
>     bmd = BIO_new(BIO_f_md());
>     if (!bmd){
>         printf("Error BIO_new bmd\n");
>         goto err_exit;
>     }
>  
>     BIO_set_md(bmd, md);

You do not check the return value here. This call will return <= 0
return value in case the legacy provider is not loaded.



-- 
Tomáš Mráz, OpenSSL





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux