[1/3] dpnet: Add check for mismatched string lengths

Stefan Dösinger stefandoesinger at gmail.com
Thu Feb 26 02:05:11 CST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm sorry, I missed one problem in my earlier reviews of this change:

Am 2015-02-26 um 04:31 schrieb Alistair Leslie-Hughes:
>          case DPNA_DATATYPE_STRING:
> +           if (((strlenW((WCHAR*)lpvData)+1)*sizeof(WCHAR)) != dwDataSize)
> +                return DPNERR_INVALIDPARAM;
>              heap_free(entry->data.string);
At the time when you do the check and the error return you have already
allocated a new entry and added it to the list. Thus if the check fails
you'll leave a zombie component attached to the address object. This
also applies to the already existing DWORD size check.

You can move the check in front of the loop that searches if such a
component name already exists. I also recommend to to write extra tests
for these cases: What happens if a new component with an invalid data
size is added? Does GetComponentByName return something? What happens if
a component already exists and you try to re-add it with an invalid
data? Does the old data stay intact?

The other two patches look good to me and seem to apply without this
one. I'll inform Alexandre on IRC. The subject of patch 3 is broken
though, maybe Alexandre can correct it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJU7tO3AAoJEN0/YqbEcdMw6z8P/AoWZwr4ysFdMvMBdqlZTVTH
bUFYX62n8gj/IADpL1TIq8NN87Q2H2gv+V9p+6IOcvymMkDOVa/jfK+tBtZVLjmy
MoLDx/+hJ2Ef8LteV2qiFO4y50btO32ibPrxY6C/jdJ5gj8dHrsjOQQSUiiAHAfQ
N4Hl1j9BVblH7elBEa/Anuk+1aArnXncYU3q2wI50HRfgVShDo+3LO8jA4XzQyQM
U3Gk0n5YeRapnPH0WAq9FH8o45dUFg3vtkx8M0wpzIHNGsZn91/RlIHOh7m5O9Xx
S6mGU9xkhIDoWsRP+I0dIROa/QDVM7aTw8z8jpPVVwc7gS/z7k95BT/skSXw/ryH
s4zOZvoS+P4vtJGgQrwnZDpEywJu7p6hdvWcUBEM85ZWvqh2Ui4em9WrW0nsmFeL
VC9WcEFG4N8vzAGRK6yF2luyKrygj8KZGukZ2HCJGrjK0pAnln+BSs2V2M4cZMd6
uJus8bKJMcM2oGoB5UbpHMKRlIgSXrO0nwibUYJ02Kp3dpTUG0oHSXer+HFzImvA
2VLinduPKpA0g9XSXtCdUaXZghpQf6K4e7lwDyoikgFZs5x5G6qNYQIx2MtrJwJ2
oQ0YILD8thFi1QQrH7DLqQAGA0kAarDs0wClct5kQ3uiiT3t9a3Rklql/EYPdz3m
VvgO1NqMg7yqPq0KMGKl
=5ibs
-----END PGP SIGNATURE-----



More information about the wine-devel mailing list