* [PATCH] apparmor: fix off-by-one comparison on MAXMAPPED_SIG
@ 2017-08-22 21:58 Colin King
2017-09-25 14:21 ` John Johansen
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-08-22 21:58 UTC (permalink / raw)
To: linux-security-module
From: Colin Ian King <colin.king@canonical.com>
There is a an off-by-one comparision on sig against MAXMAPPED_SIG
that can lead to a read outside the sig_map array if sig
is MAXMAPPED_SIG. Fix this.
Detected with cppcheck:
"Either the condition 'sig<=35' is redundant or the array 'sig_map[35]'
is accessed at index 35, which is out of bounds."
Fixes: c6bf1adaecaa ("apparmor: add the ability to mediate signals")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
security/apparmor/ipc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c
index 66fb9ede9447..5091c78062e4 100644
--- a/security/apparmor/ipc.c
+++ b/security/apparmor/ipc.c
@@ -128,7 +128,7 @@ static inline int map_signal_num(int sig)
return SIGUNKNOWN;
else if (sig >= SIGRTMIN)
return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */
- else if (sig <= MAXMAPPED_SIG)
+ else if (sig < MAXMAPPED_SIG)
return sig_map[sig];
return SIGUNKNOWN;
}
--
2.14.1
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info@ http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] apparmor: fix off-by-one comparison on MAXMAPPED_SIG
2017-08-22 21:58 [PATCH] apparmor: fix off-by-one comparison on MAXMAPPED_SIG Colin King
@ 2017-09-25 14:21 ` John Johansen
0 siblings, 0 replies; 2+ messages in thread
From: John Johansen @ 2017-09-25 14:21 UTC (permalink / raw)
To: linux-security-module
On 08/22/2017 05:58 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> There is a an off-by-one comparision on sig against MAXMAPPED_SIG
> that can lead to a read outside the sig_map array if sig
> is MAXMAPPED_SIG. Fix this.
>
> Detected with cppcheck:
> "Either the condition 'sig<=35' is redundant or the array 'sig_map[35]'
> is accessed at index 35, which is out of bounds."
>
> Fixes: c6bf1adaecaa ("apparmor: add the ability to mediate signals")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> security/apparmor/ipc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c
> index 66fb9ede9447..5091c78062e4 100644
> --- a/security/apparmor/ipc.c
> +++ b/security/apparmor/ipc.c
> @@ -128,7 +128,7 @@ static inline int map_signal_num(int sig)
> return SIGUNKNOWN;
> else if (sig >= SIGRTMIN)
> return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */
> - else if (sig <= MAXMAPPED_SIG)
> + else if (sig < MAXMAPPED_SIG)
> return sig_map[sig];
> return SIGUNKNOWN;
> }
>
I've pulled this in to apparmor-next
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-25 14:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 21:58 [PATCH] apparmor: fix off-by-one comparison on MAXMAPPED_SIG Colin King
2017-09-25 14:21 ` John Johansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).