Description
Somehow it is possible to put a REG_SZ into the windows registry without terminating \0 characters.
We have this bug in one rare case where a device driver puts its device file name into the registry. regedit will show the string correctly, also regedt32.exe.
With regedt32.exe you can clearly see that the binary information of the string does not contain two trailing 00 00 bytes.
When reading this String with QSettings, Qt will give you the string with garbage appended because the string is not correctly terminated.
Possible fix:
Change line 488 in qsettings_win.cpp from
QByteArray data(dataSize, 0);
to
QByteArray data(dataSize + 2, 0);
This will ensure, that the the String has always terminating null characters.
Attachments
For Gerrit Dashboard: QTBUG-51382 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
150784,2 | Fixed reading REG_SZ without terminating \0 delivers garbage | dev | qt/qtbase | Status: ABANDONED | -2 | 0 |
150885,2 | Fixed reading REG_SZ without terminating \0 delivers garbage | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |