Re: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
Thanks. The solution looks good. I recommend to add more comments below: // Because the function does not actually print anything to buf, it returns -1 as error. // Otherwise, the consumer may think that the buf is valid and parse the buffer. With comment change, reviewed-by: Jiewen Yao > -Original Message- > From: Li, Yi1 > Sent: Sunday, September 25, 2022 5:40 PM > To: devel@edk2.groups.io; Li, Yi1 ; Yao, Jiewen > > Cc: Wang, Jian J ; Lu, Xiaoyu1 > ; Jiang, Guomin > Subject: RE: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer- > overflow due to BIO_snprintf() > > Hi Jiewen, > Can you take a look at this patch? > WPA3 Tls API fuzzing is blocked because of same pem API. > > Thanks, > Yi > > -Original Message- > From: devel@edk2.groups.io On Behalf Of yi1 li > Sent: Thursday, September 22, 2022 8:53 PM > To: devel@edk2.groups.io > Cc: Li, Yi1 ; Yao, Jiewen ; Wang, > Jian J ; Lu, Xiaoyu1 ; Jiang, > Guomin > Subject: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow > due to BIO_snprintf() > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075 > > Fake BIO_snprintf() need to return error status -1. 0 will be considered a > correct return value, this may cause crash, please refer to bugzilla link for > details. > > Signed-off-by: Yi Li > > Cc: Jiewen Yao > Cc: Jian J Wang > Cc: Xiaoyu Lu > Cc: Guomin Jiang > --- > CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c > b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c > index c1fc33538f..d7d8c206ed 100644 > --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c > +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c > @@ -494,7 +494,7 @@ BIO_snprintf ( >... >) > { > - return 0; > + return -1; > } > > #ifdef __GNUC__ > -- > 2.31.1.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94293): https://edk2.groups.io/g/devel/message/94293 Mute This Topic: https://groups.io/mt/93847550/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
Hi Jiewen, Can you take a look at this patch? WPA3 Tls API fuzzing is blocked because of same pem API. Thanks, Yi -Original Message- From: devel@edk2.groups.io On Behalf Of yi1 li Sent: Thursday, September 22, 2022 8:53 PM To: devel@edk2.groups.io Cc: Li, Yi1 ; Yao, Jiewen ; Wang, Jian J ; Lu, Xiaoyu1 ; Jiang, Guomin Subject: [edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf() REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075 Fake BIO_snprintf() need to return error status -1. 0 will be considered a correct return value, this may cause crash, please refer to bugzilla link for details. Signed-off-by: Yi Li Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang --- CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c index c1fc33538f..d7d8c206ed 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c @@ -494,7 +494,7 @@ BIO_snprintf ( ... ) { - return 0; + return -1; } #ifdef __GNUC__ -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94292): https://edk2.groups.io/g/devel/message/94292 Mute This Topic: https://groups.io/mt/93847550/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH 1/1] CryptoPkg: Fix pem heap-buffer-overflow due to BIO_snprintf()
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4075 Fake BIO_snprintf() need to return error status -1. 0 will be considered a correct return value, this may cause crash, please refer to bugzilla link for details. Signed-off-by: Yi Li Cc: Jiewen Yao Cc: Jian J Wang Cc: Xiaoyu Lu Cc: Guomin Jiang --- CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c index c1fc33538f..d7d8c206ed 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c @@ -494,7 +494,7 @@ BIO_snprintf ( ... ) { - return 0; + return -1; } #ifdef __GNUC__ -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94119): https://edk2.groups.io/g/devel/message/94119 Mute This Topic: https://groups.io/mt/93847550/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-