mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
base64: prevent writing null char into zero length output buffer
This allows handling of the unusal but foreseeable situation were the client provides a zero length output buffer, for example, if the input buffer was also zero length.
This commit is contained in:
parent
c735a9f383
commit
781c6f3227
1 changed files with 3 additions and 1 deletions
|
@ -164,7 +164,9 @@ lws_b64_decode_stateful(struct lws_b64state *s, const char *in, size_t *in_len,
|
|||
s->len = 0;
|
||||
}
|
||||
|
||||
*out = '\0';
|
||||
if (out < end_out)
|
||||
*out = '\0';
|
||||
|
||||
*in_len = (unsigned int)(in - orig_in);
|
||||
*out_size = (unsigned int)(out - orig_out);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue