diff options
author | Daiki Ueno <dueno@redhat.com> | 2016-09-22 14:47:18 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2016-12-06 13:12:00 +0100 |
commit | 65e8ad30e7832f3a979f88f4308cfa4f9a969829 (patch) | |
tree | 86e54a766517caee2209c387048cdc6bcdd37e47 /trust | |
parent | 99c3d823fc96c47af4810a5ee091501721159a48 (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 'trust')
-rw-r--r-- | trust/base64.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/trust/base64.c b/trust/base64.c index a9eb966..01ed8ef 100644 --- a/trust/base64.c +++ b/trust/base64.c @@ -43,9 +43,11 @@ #include "config.h" #include "base64.h" +#include "debug.h" #include <assert.h> #include <ctype.h> +#include <limits.h> #include <stdlib.h> #include <string.h> @@ -99,6 +101,7 @@ p11_b64_pton (const char *src, state = 1; break; case 1: + return_val_if_fail (tarindex < INT_MAX, -1); if (target) { if ((size_t) tarindex + 1 >= targsize) return (-1); @@ -110,6 +113,7 @@ p11_b64_pton (const char *src, state = 2; break; case 2: + return_val_if_fail (tarindex < INT_MAX, -1); if (target) { if ((size_t) tarindex + 1 >= targsize) return (-1); @@ -121,6 +125,7 @@ p11_b64_pton (const char *src, state = 3; break; case 3: + return_val_if_fail (tarindex < INT_MAX, -1); if (target) { if ((size_t) tarindex >= targsize) return (-1); |