diff options
author | Justus Winter <[email protected]> | 2016-11-29 12:31:38 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-11-29 13:45:56 +0000 |
commit | e062bc4da8062b822ee85096d9adfcbca8dcb56a (patch) | |
tree | 83466ea75f38b7f44a31d9aded62eaa075f098e9 /tests/gpgscm/scheme.c | |
parent | dirmngr: Lazily launch ldap reaper thread. (diff) | |
download | gnupg-e062bc4da8062b822ee85096d9adfcbca8dcb56a.tar.gz gnupg-e062bc4da8062b822ee85096d9adfcbca8dcb56a.zip |
gpgscm: Avoid truncating pointers.
* tests/gpgscm/scheme.c (_alloc_cellseg): Avoid truncating pointers on
systems where sizeof(unsigned long) < sizeof(void *).
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | tests/gpgscm/scheme.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 866654862..30b59157b 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -29,6 +29,7 @@ #include <assert.h> #include <limits.h> +#include <stdint.h> #include <float.h> #include <ctype.h> @@ -615,8 +616,8 @@ _alloc_cellseg(scheme *sc, size_t len, void **alloc, pointer *cells) *alloc = cp; /* adjust in TYPE_BITS-bit boundary */ - if (((unsigned long) cp) % adj != 0) - cp = (void *) (adj * ((unsigned long) cp / adj + 1)); + if (((uintptr_t) cp) % adj != 0) + cp = (void *) (adj * ((uintptr_t) cp / adj + 1)); *cells = cp; return 0; |