safeguard sync
authorVolker Birk <vb@pep.foundation>
Sun, 21 Oct 2018 13:50:00 +0200
branchsync
changeset 3011c2024f3dedc
parent 300 c56d273d3694
child 302 b3444780fa9f
safeguard
GateKeeper.cpp
     1.1 --- a/GateKeeper.cpp	Sun Oct 21 13:47:25 2018 +0200
     1.2 +++ b/GateKeeper.cpp	Sun Oct 21 13:50:00 2018 +0200
     1.3 @@ -321,7 +321,7 @@
     1.4          memset(&pi, 0, sizeof(BCRYPT_OAEP_PADDING_INFO));
     1.5          pi.pszAlgId = BCRYPT_SHA256_ALGORITHM;
     1.6  
     1.7 -        ULONG result_size;
     1.8 +        ULONG result_size = 0;
     1.9          PUCHAR _result = NULL;
    1.10          ULONG blob_size = export_size - sizeof(BCRYPT_KEY_DATA_BLOB_HEADER);
    1.11          PUCHAR blob = _delivery_key + sizeof(BCRYPT_KEY_DATA_BLOB_HEADER);
    1.12 @@ -332,7 +332,7 @@
    1.13              throw runtime_error("BCryptEncrypt: calculating result size");
    1.14          }
    1.15  
    1.16 -        _result = new UCHAR[result_size];
    1.17 +        _result = new UCHAR[result_size + 1];
    1.18          status = BCryptEncrypt(hUpdateKey, blob, blob_size, &pi, NULL, 0, _result, result_size, &copied, BCRYPT_PAD_OAEP);
    1.19          delete[] _delivery_key;
    1.20          if (status) {