We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da72f68 commit 9cdb7a1Copy full SHA for 9cdb7a1
jwt.c
@@ -516,9 +516,11 @@ static void php_jwt_encode(INTERNAL_FUNCTION_PARAMETERS) {
516
zend_string *sig_str = zend_string_init(sig, sig_len, 0);
517
char *sig_b64 = jwt_b64_url_encode(sig_str);
518
519
- buf = (char *)erealloc(buf, strlen(sig_b64) + strlen(buf) + 1);
520
- strcat(buf, ".");
521
- strcat(buf, sig_b64);
+ char *tmp = (char *)emalloc(strlen(sig_b64) + strlen(buf) + 1);
+ sprintf(tmp, "%s.%s", buf, sig_b64);
+
522
+ efree(buf);
523
+ buf = tmp;
524
525
efree(sig_b64);
526
zend_string_free(jwt->str);
0 commit comments