aboutsummaryrefslogtreecommitdiffstats
path: root/main/ca-certificates/0003-update-ca-insert-newline-between-certs.patch
blob: 4a945a076baf4a1d1aede364d5752770ff69890f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From fd399b2416191bd7f3b0f267bdb530ed829de271 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Wed, 5 Feb 2020 17:40:57 +0100
Subject: [PATCH 3/3] update-ca: insert newline between certs

There may be certificates that lack a trailing newline, which is allowed
in the certificate format. We work around that by inject a newline after
each cert.

see https://gitlab.alpinelinux.org/alpine/aports/issues/8379
---
 update-ca.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/update-ca.c b/update-ca.c
index 2b3195b..0260f83 100644
--- a/update-ca.c
+++ b/update-ca.c
@@ -191,6 +191,7 @@ static void proc_localglobaldir(const char *fullpath, struct hash *h, int tmpfil
 		fprintf(stderr, "Warning! Cannot hash: %s\n", fullpath);
 	if (!copyfile(fullpath, tmpfile_fd))
 		fprintf(stderr, "Warning! Cannot copy to bundle: %s\n", fullpath);
+	write(tmpfile_fd, "\n", 1);
 	free(actual_file);
 }
 
@@ -260,7 +261,7 @@ static bool dir_readfiles(struct hash* d, const char* path,
 	DIR *dp = opendir(path);
 	if (!dp)
 		return false;
- 
+
 	struct dirent *dirp;
 	while ((dirp = readdir(dp)) != NULL) {
 		if (str_begins(dirp->d_name, "."))
-- 
2.25.0