Skip to content

Commit 1dfb222

Browse files
committed
Fix WHIP basic auth base64 encode error
1 parent 1638df9 commit 1dfb222

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)