svn commit: samba r16270 - in branches/SAMBA_3_0/source/utils: .
jra at samba.org
jra at samba.org
Thu Jun 15 21:46:15 GMT 2006
Author: jra
Date: 2006-06-15 21:46:15 +0000 (Thu, 15 Jun 2006)
New Revision: 16270
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16270
Log:
Fix Klocwork #706 - ensure sscanf has correct format
specifier.
Jeremy.
Modified:
branches/SAMBA_3_0/source/utils/net_idmap.c
Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_idmap.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_idmap.c 2006-06-15 21:45:10 UTC (rev 16269)
+++ branches/SAMBA_3_0/source/utils/net_idmap.c 2006-06-15 21:46:15 UTC (rev 16270)
@@ -193,7 +193,7 @@
}
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 @@
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;
}
More information about the samba-cvs
mailing list