summaryrefslogtreecommitdiff
path: root/source3/winbindd/idmap_autorid.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-23 15:26:38 +0100
committerVolker Lendecke <vl@samba.org>2011-02-23 15:59:11 +0100
commitdfd33bcbb81998e68c00d2a01aab6b5c468ecf87 (patch)
tree55c89110111636494a38c8c00506ce7d7187c4de /source3/winbindd/idmap_autorid.c
parent9671615592a2e539a661698373dd3f7c7dd82d73 (diff)
downloadsamba-dfd33bcbb81998e68c00d2a01aab6b5c468ecf87.tar.gz
samba-dfd33bcbb81998e68c00d2a01aab6b5c468ecf87.tar.bz2
samba-dfd33bcbb81998e68c00d2a01aab6b5c468ecf87.zip
s3: Fix 64-bit errors
Casting those variables will lead to sscanf believing that it sees pointers to unsigned longs. These might be 64 bit long, thus sscanf will overwrite memory it should not overwrite. Assigning the vars later is okay, there we get automatic type conversion. C can be nasty ... Christian, please check!
Diffstat (limited to 'source3/winbindd/idmap_autorid.c')
-rw-r--r--source3/winbindd/idmap_autorid.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index 756c6c29af..ae65647ed6 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -395,6 +395,7 @@ static struct autorid_global_config *idmap_autorid_loadconfig(TALLOC_CTX * ctx)
TDB_DATA data;
struct autorid_global_config *cfg;
+ unsigned long minvalue, rangesize, maxranges;
data = dbwrap_fetch_bystring(autorid_db, ctx, CONFIGKEY);
@@ -408,16 +409,19 @@ static struct autorid_global_config *idmap_autorid_loadconfig(TALLOC_CTX * ctx)
return NULL;
}
- if (sscanf
- ((char *)data.dptr, "minvalue:%lu rangesize:%lu maxranges:%lu",
- (unsigned long *)&cfg->minvalue, (unsigned long *)&cfg->rangesize,
- (unsigned long *)&cfg->maxranges) != 3) {
+ if (sscanf((char *)data.dptr,
+ "minvalue:%lu rangesize:%lu maxranges:%lu",
+ &minvalue, &rangesize, &maxranges) != 3) {
DEBUG(1,
("Found invalid configuration data"
"creating new config\n"));
return NULL;
}
+ cfg->minvalue = minvalue;
+ cfg->rangesize = rangesize;
+ cfg->maxranges = maxranges;
+
DEBUG(10, ("Loaded previously stored configuration "
"minvalue:%d rangesize:%d\n",
cfg->minvalue, cfg->rangesize));