Hans Leidekker : ncrypt: Fix resizing property array.

Alexandre Julliard julliard at winehq.org
Thu Feb 17 15:33:59 CST 2022


Module: wine
Branch: master
Commit: 26d8f334796bca16dfb17ae7ecf9e47de4577cce
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=26d8f334796bca16dfb17ae7ecf9e47de4577cce

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Feb 17 11:06:29 2022 +0100

ncrypt: Fix resizing property array.

Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ncrypt/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/ncrypt/main.c b/dlls/ncrypt/main.c
index 6b1a87ea785..ca70b2d92c3 100644
--- a/dlls/ncrypt/main.c
+++ b/dlls/ncrypt/main.c
@@ -312,7 +312,7 @@ SECURITY_STATUS WINAPI NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE *provider, c
 
 static SECURITY_STATUS set_object_property(struct object *object, const WCHAR *name, BYTE *value, DWORD value_size)
 {
-    struct object_property *property = &object->properties[object->num_properties];
+    struct object_property *property;
 
     FIXME("check duplicates\n");
     if (!object->num_properties)
@@ -322,18 +322,18 @@ static SECURITY_STATUS set_object_property(struct object *object, const WCHAR *n
             ERR("Error allocating memory.");
             return NTE_NO_MEMORY;
         }
-        object->num_properties++;
+        property = &object->properties[object->num_properties++];
     }
     else
     {
         struct object_property *tmp;
-        if (!(tmp = realloc(object->properties, sizeof(*property) * object->num_properties + 1)))
+        if (!(tmp = realloc(object->properties, sizeof(*property) * (object->num_properties + 1))))
         {
             ERR("Error allocating memory.");
             return NTE_NO_MEMORY;
         }
         object->properties = tmp;
-        object->num_properties++;
+        property = &object->properties[object->num_properties++];
     }
 
     memset(property, 0, sizeof(*property));




More information about the wine-cvs mailing list