Skip to content

Commit 2ac8737

Browse files
committed
Merge branch 'bugfix/fix_whip_base64_size_error' into 'main'
Fix WHIP basic auth base64 encode error See merge request adf/esp-webrtc-solution!30
2 parents 1638df9 + 1dfb222 commit 2ac8737

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/esp_webrtc/impl/whip_signal/whip_signaling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static char *get_auth_header(esp_peer_signaling_whip_cfg_t *whip_cfg)
192192
size_t token_len = cfg_len;
193193
int auth_len = (whip_cfg->auth_type == ESP_PEER_SIGNALING_WHIP_AUTH_TYPE_BASIC) ? strlen("Authorization: Basic ") : strlen("Authorization: Bearer ");
194194
if (whip_cfg->auth_type == ESP_PEER_SIGNALING_WHIP_AUTH_TYPE_BASIC) {
195-
token_len = (token_len * 4 / 3) + 2;
195+
token_len = ((token_len + 2) / 3) * 4 + 1;
196196
}
197197
int len = auth_len + token_len + 1;
198198
char *auth = malloc(len);

0 commit comments

Comments
 (0)