mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-15 02:05:40 +00:00
Fix buffer over-read in percent_decode().
When decoding a trigram, percent_decode() would correctly increment the input pointer by an extra two characters (three total) but would not decrement the input length by the same amount. This would result in a buffer over-read when decoding unterminated strings.
This commit is contained in:
parent
476374323d
commit
c044f2580b
1 changed files with 1 additions and 0 deletions
|
@ -92,6 +92,7 @@ percent_decode(const char *in, size_t ilen, char *out, size_t *olen)
|
|||
if (++len < *olen && out != NULL)
|
||||
*out++ = unhex(in[1]) << 4 | unhex(in[2]);
|
||||
in += 2;
|
||||
ilen -= 2;
|
||||
} else {
|
||||
if (*olen > 0 && out != NULL)
|
||||
*out = '\0';
|
||||
|
|
Loading…
Reference in a new issue