summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-06-15 21:46:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:17:29 -0500
commitc2528679d8a5da90c027f21c4970a211c5175da9 (patch)
tree696414a1ed761e0e537e152fea4c316e3c375d28 /source3
parent9e7377e81f61b2a3e4b8ff4cc5cd926e25ddacf3 (diff)
downloadsamba-c2528679d8a5da90c027f21c4970a211c5175da9.tar.gz
samba-c2528679d8a5da90c027f21c4970a211c5175da9.tar.bz2
samba-c2528679d8a5da90c027f21c4970a211c5175da9.zip
r16270: Fix Klocwork #706 - ensure sscanf has correct format
specifier. Jeremy. (This used to be commit dc53d35b0a1491da94e231943a81547be4c75631)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_idmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index 0b5f68101e..47e1f93b69 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -193,7 +193,7 @@ static int net_idmap_restore(int argc, const char **argv)
}
while (!feof(stdin)) {
- fstring line, sid_string;
+ fstring line, sid_string, fmt_string;
int len;
unid_t id;
int type = ID_EMPTY;
@@ -208,14 +208,15 @@ static int net_idmap_restore(int argc, const char **argv)
line[len-1] = '\0';
/* Yuck - this is broken for sizeof(gid_t) != sizeof(int) */
-
- if (sscanf(line, "GID %d %s", &id.gid, sid_string) == 2) {
+ snprintf(fmt_string, sizeof(fmt_string), "GID %%d %%%us", FSTRING_LEN);
+ if (sscanf(line, fmt_string, &id.gid, sid_string) == 2) {
type = ID_GROUPID;
}
/* Yuck - this is broken for sizeof(uid_t) != sizeof(int) */
- if (sscanf(line, "UID %d %s", &id.uid, sid_string) == 2) {
+ snprintf(fmt_string, sizeof(fmt_string), "UID %%d %%%us", FSTRING_LEN);
+ if (sscanf(line, fmt_string, &id.uid, sid_string) == 2) {
type = ID_USERID;
}