Skip to content

Commit d787b0e

Browse files
committed
ensure null termination
1 parent 295303b commit d787b0e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/curl/interface.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,9 @@ static void create_certinfo(struct curl_certinfo *ci, zval *listcode TSRMLS_DC)
18511851
int len;
18521852
char s[64];
18531853
char *tmp;
1854-
strncpy(s, slist->data, 64);
1855-
tmp = memchr(s, ':', 64);
1854+
strncpy(s, slist->data, sizeof(s));
1855+
s[sizeof(s)-1] = '\0';
1856+
tmp = memchr(s, ':', sizeof(s));
18561857
if(tmp) {
18571858
*tmp = '\0';
18581859
len = strlen(s);

0 commit comments

Comments
 (0)