r4038: fix sign/unsign bug I introduced in -r 4022
authorStefan Metzmacher <metze@samba.org>
Thu, 2 Dec 2004 10:14:40 +0000 (10:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:06:16 +0000 (13:06 -0500)
this caused new ldb record to be corrupt if the length was > 12b byte

thanks tridge for finding this

metze
(This used to be commit 6998c37b473d8efeb2ed5285f10f469a29ad787a)

source4/lib/ldb/ldb_tdb/ldb_pack.c

index bfbc4841a63a7095fc95fa7752ef2446bcd747b8..0ebf62df8d117963411d961d71bca59275d21141 100644 (file)
@@ -44,7 +44,7 @@
 #define LTDB_PACKING_FORMAT_NODN 0x26011966
 
 /* use a portable integer format */
 #define LTDB_PACKING_FORMAT_NODN 0x26011966
 
 /* use a portable integer format */
-static void put_uint32(char *p, int ofs, unsigned int val)
+static void put_uint32(uint32 *p, int ofs, unsigned int val)
 {
        p += ofs;
        p[0] = val&0xFF;
 {
        p += ofs;
        p[0] = val&0xFF;
@@ -53,7 +53,7 @@ static void put_uint32(char *p, int ofs, unsigned int val)
        p[3] = (val>>24) & 0xFF;
 }
 
        p[3] = (val>>24) & 0xFF;
 }
 
-static unsigned int pull_uint32(char *p, int ofs)
+static unsigned int pull_uint32(uint32 *p, int ofs)
 {
        p += ofs;
        return p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
 {
        p += ofs;
        return p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);