mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-05-26 08:05:10 +02:00
Fix when olen == 0
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -313,6 +313,9 @@ int base64url_encode(unsigned char *dst, size_t dlen, size_t *olen, const unsign
|
||||
dst[i] = '_';
|
||||
}
|
||||
}
|
||||
if (*olen == 0) {
|
||||
return 0;
|
||||
}
|
||||
uint8_t *p = dst + *olen - 1;
|
||||
while (*p == '=') {
|
||||
*p-- = '\0';
|
||||
@@ -363,4 +366,4 @@ int b64url_decoded_len(size_t n, size_t *out_len) {
|
||||
|
||||
*out_len = out;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user