[PATCH] secur32: Ignore attribute when searching for buffer type

Julien Loir mini.jul.jl at gmail.com
Sun Jul 25 07:37:46 CDT 2021


Buffer types in PSecBufferDesc can have an optional attribute. When searching, it must be ignored to ensure the buffer type is found.
Signed-off-by: Julien Loir <mini.jul.jl at gmail.com>
---
Example of initialization usage that fails without this patch: https://github.com/matoya/libmatoya/blob/master/src/windows/tlsw.c#L275
---
 dlls/secur32/schannel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 515f01d08a3..eb8106e88c7 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -659,7 +659,8 @@ static int schan_find_sec_buffer_idx(const SecBufferDesc *desc, unsigned int sta
     for (i = start_idx; i < desc->cBuffers; ++i)
     {
         buffer = &desc->pBuffers[i];
-        if (buffer->BufferType == buffer_type) return i;
+        if ((buffer->BufferType | SECBUFFER_ATTRMASK) == (buffer_type | SECBUFFER_ATTRMASK))
+            return i;
     }
 
     return -1;
-- 
2.32.0




More information about the wine-devel mailing list