summaryrefslogtreecommitdiff
path: root/common/path.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2016-09-22 14:47:18 +0200
committerDaiki Ueno <ueno@gnu.org>2016-12-06 13:12:00 +0100
commit65e8ad30e7832f3a979f88f4308cfa4f9a969829 (patch)
tree86e54a766517caee2209c387048cdc6bcdd37e47 /common/path.c
parent99c3d823fc96c47af4810a5ee091501721159a48 (diff)
common, trust: Avoid integer overflow
This fixes issues pointed in: https://bugzilla.redhat.com/show_bug.cgi?id=985445 except for p11-kit/conf.c:read_config_file(), which was rewritten using mmap() and thus length calculation is no longer needed.
Diffstat (limited to 'common/path.c')
-rw-r--r--common/path.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/path.c b/common/path.c
index 34c00cb..8b8b66c 100644
--- a/common/path.c
+++ b/common/path.c
@@ -214,7 +214,9 @@ p11_path_build (const char *path,
len = 1;
va_start (va, path);
while (path != NULL) {
+ size_t old_len = len;
len += strlen (path) + 1;
+ return_val_if_fail (len >= old_len, NULL);
path = va_arg (va, const char *);
}
va_end (va);