[Pkg-gnupg-commit] [gnupg2] 29/180: gpgscm: Avoid truncating pointers.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Sat Dec 24 22:29:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit e062bc4da8062b822ee85096d9adfcbca8dcb56a
Author: Justus Winter <justus at g10code.com>
Date:   Tue Nov 29 13:31:38 2016 +0100

    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 <justus at g10code.com>
---
 tests/gpgscm/scheme.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 8666548..30b5915 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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list