diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-02-18 04:49:34 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-02-18 04:49:34 -0800 |
| commit | 01d1a791d1a13df17b649459eec6830f226c7163 (patch) | |
| tree | 851c48c86a683ab46e89b9fff7b4fc9eba36cde1 /security | |
| parent | 53b15b863e95defe1487a67e6ca5502a0b4d3e5f (diff) | |
[PATCH] snprintf fixes
From: Juergen Quade <quade@hsnr.de>
Lots of places in the kernel are using [v]snprintf wrongly: they assume it
returns the number of characters copied. It doesn't. It returns the
number of characters which _would_ have been copied had the buffer not been
filled up.
So create new functions vscnprintf() and scnprintf() which have the
expected (sane) semaptics, and migrate callers over to using them.
Diffstat (limited to 'security')
| -rw-r--r-- | security/selinux/selinuxfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 531faa197107..08b1958fecb0 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c @@ -56,7 +56,7 @@ static ssize_t sel_read_enforce(struct file *filp, char *buf, return -ENOMEM; memset(page, 0, PAGE_SIZE); - length = snprintf(page, PAGE_SIZE, "%d", selinux_enforcing); + length = scnprintf(page, PAGE_SIZE, "%d", selinux_enforcing); if (length < 0) { free_page((unsigned long)page); return length; @@ -142,7 +142,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char *buf, return -ENOMEM; memset(page, 0, PAGE_SIZE); - length = snprintf(page, PAGE_SIZE, "%u", POLICYDB_VERSION); + length = scnprintf(page, PAGE_SIZE, "%u", POLICYDB_VERSION); if (length < 0) { free_page((unsigned long)page); return length; @@ -407,7 +407,7 @@ static ssize_t sel_write_access(struct file * file, char *buf, size_t size) if (length < 0) goto out2; - length = snprintf(buf, PAYLOAD_SIZE, "%x %x %x %x %u", + length = scnprintf(buf, PAYLOAD_SIZE, "%x %x %x %x %u", avd.allowed, avd.decided, avd.auditallow, avd.auditdeny, avd.seqno); |
