summaryrefslogtreecommitdiffstats
path: root/security/integrity
diff options
context:
space:
mode:
authorRoberto Sassu2013-11-27 14:40:41 +0100
committerJames Morris2013-11-30 03:09:53 +0100
commitaf91706d5ddecb4a9858cca9e90d463037cfd498 (patch)
tree6deb94f92beb6a51eadad053ded7da136847062f /security/integrity
parentLinux 3.13-rc2 (diff)
downloadkernel-qcow2-linux-af91706d5ddecb4a9858cca9e90d463037cfd498.tar.gz
kernel-qcow2-linux-af91706d5ddecb4a9858cca9e90d463037cfd498.tar.xz
kernel-qcow2-linux-af91706d5ddecb4a9858cca9e90d463037cfd498.zip
ima: store address of template_fmt_copy in a pointer before calling strsep
This patch stores the address of the 'template_fmt_copy' variable in a new variable, called 'template_fmt_ptr', so that the latter is passed as an argument of strsep() instead of the former. This modification is needed in order to correctly free the memory area referenced by 'template_fmt_copy' (strsep() modifies the pointer of the passed string). Signed-off-by: Roberto Sassu <roberto.sassu@polito.it> Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Signed-off-by: Mimi Zohar <zohar@us.ibm.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'security/integrity')
-rw-r--r--security/integrity/ima/ima_template.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
index 913e1927f916..635695f6a185 100644
--- a/security/integrity/ima/ima_template.c
+++ b/security/integrity/ima/ima_template.c
@@ -110,7 +110,7 @@ static int template_desc_init_fields(const char *template_fmt,
struct ima_template_field ***fields,
int *num_fields)
{
- char *c, *template_fmt_copy;
+ char *c, *template_fmt_copy, *template_fmt_ptr;
int template_num_fields = template_fmt_size(template_fmt);
int i, result = 0;
@@ -127,7 +127,9 @@ static int template_desc_init_fields(const char *template_fmt,
result = -ENOMEM;
goto out;
}
- for (i = 0; (c = strsep(&template_fmt_copy, "|")) != NULL &&
+
+ template_fmt_ptr = template_fmt_copy;
+ for (i = 0; (c = strsep(&template_fmt_ptr, "|")) != NULL &&
i < template_num_fields; i++) {
struct ima_template_field *f = lookup_template_field(c);
46a6257'>bpf: xor of a/x in cbpf can be done in 32 bit aluDaniel Borkmann2018-01-271-2/+2 * bpf: Add sock_ops R/W access to tclassLawrence Brakmo2018-01-261-2/+45 * bpf: Add support for reading sk_state and moreLawrence Brakmo2018-01-261-11/+132 * bpf: Adds field bpf_sock_ops_cb_flags to tcp_sockLawrence Brakmo2018-01-261-0/+34 * bpf: Add write access to tcp_sock and sock fieldsLawrence Brakmo2018-01-261-0/+48 * bpf: Make SOCK_OPS_GET_TCP struct independentLawrence Brakmo2018-01-261-10/+10 * bpf: Make SOCK_OPS_GET_TCP size independentLawrence Brakmo2018-01-261-5/+8 * bpf: Only reply field should be writeableLawrence Brakmo2018-01-261-2/+1Star * Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-nextDavid S. Miller2018-01-211-2/+5 |\ | * bpf: move event_output to const_size_or_zero for xdp/skb as wellDaniel Borkmann2018-01-201-2/+2 | * bpf: add csum_diff helper to xdp as wellDaniel Borkmann2018-01-201-0/+2 | * bpf: allow socket_filter programs to use bpf_prog_test_runAlexei Starovoitov2018-01-181-0/+1 * | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2018-01-201-0/+4 |\ \ | |/ |/| | * bpf: fix 32-bit divide by zeroAlexei Starovoitov2018-01-141-0/+4 * | bpf: simplify xdp_convert_ctx_access for xdp_rxq_infoJesper Dangaard Brouer2018-01-131-4/+3Star * | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller2018-01-121-4/+2Star |\| | * bpf: introduce BPF_JIT_ALWAYS_ON configAlexei Starovoitov2018-01-09