qt: Fix an rfc2253 parser flaw

* lang/qt/src/dn.cpp (parse_dn_part): Fix parser.

--

This could in theory result in reading bytes after a after Nul in a
string and thus possible segv on unallocated memory or reading other
parts of the memory.  However, it is harmless because the rfc2253
strings have been received from GnuPG which is expected to emit
correct syntax.

GnuPG-bug-id: 5037
This commit is contained in:
Werner Koch 2020-08-28 09:12:55 +02:00
parent f66f856c89
commit b088d81cef
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -177,9 +177,8 @@ parse_dn_part(DnPair *array, const unsigned char *string)
if (*string == '#') {
/* hexstring */
string++;
for (s = string; hexdigitp(s); s++) {
s++;
}
for (s = string; hexdigitp(s); s++)
;
n = s - string;
if (!n || (n & 1)) {
return NULL; /* empty or odd number of digits */