Skip to content

Commit 9cdb7a1

Browse files
committed
Fixing Linux compilation problems.
1 parent da72f68 commit 9cdb7a1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

jwt.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,11 @@ static void php_jwt_encode(INTERNAL_FUNCTION_PARAMETERS) {
516516
zend_string *sig_str = zend_string_init(sig, sig_len, 0);
517517
char *sig_b64 = jwt_b64_url_encode(sig_str);
518518

519-
buf = (char *)erealloc(buf, strlen(sig_b64) + strlen(buf) + 1);
520-
strcat(buf, ".");
521-
strcat(buf, sig_b64);
519+
char *tmp = (char *)emalloc(strlen(sig_b64) + strlen(buf) + 1);
520+
sprintf(tmp, "%s.%s", buf, sig_b64);
521+
522+
efree(buf);
523+
buf = tmp;
522524

523525
efree(sig_b64);
524526
zend_string_free(jwt->str);

0 commit comments

Comments
 (0)