Skip to content

Commit 8e51cfe

Browse files
committed
Use zend_string_concat helper instead of strpprintf
1 parent 06896d1 commit 8e51cfe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/phar/func_interceptors.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,14 @@ static zend_string* phar_get_name_for_relative_paths(zend_string *filename, bool
137137
goto notfound;
138138
}
139139
}
140-
// TODO Known sizes use string concat helper
141140
/* auto-convert to phar:// */
142141
if (entry[0] == '/') {
143-
name = strpprintf(4096, "phar://%s%s", arch, entry);
142+
ZEND_ASSERT(strlen("phar://") + arch_len + entry_len < 4096);
143+
name = zend_string_concat3(
144+
"phar://", strlen("phar://"),
145+
arch, arch_len,
146+
entry, entry_len
147+
);
144148
} else {
145149
name = strpprintf(4096, "phar://%s/%s", arch, entry);
146150
}

0 commit comments

Comments
 (0)