mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
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@g10code.com>
This commit is contained in:
parent
f6728d13e8
commit
e062bc4da8
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user