Patch "net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-ieee802154-adf7242-fix-some-potential-buffer-ove.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c5b7ae96ed920d89c5e818544a54176f669b1e2a
Author: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
Date:   Sat Oct 21 20:03:53 2023 +0200

    net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
    
    [ Upstream commit ca082f019d8fbb983f03080487946da714154bae ]
    
    strncat() usage in adf7242_debugfs_init() is wrong.
    The size given to strncat() is the maximum number of bytes that can be
    written, excluding the trailing NULL.
    
    Here, the size that is passed, DNAME_INLINE_LEN, does not take into account
    the size of "adf7242-" that is already in the array.
    
    In order to fix it, use snprintf() instead.
    
    Fixes: 7302b9d90117 ("ieee802154/adf7242: Driver for ADF7242 MAC IEEE802154")
    Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 5cf218c674a5a..32d92bdabd234 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -1162,9 +1162,10 @@ static int adf7242_stats_show(struct seq_file *file, void *offset)
 
 static void adf7242_debugfs_init(struct adf7242_local *lp)
 {
-	char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "adf7242-";
+	char debugfs_dir_name[DNAME_INLINE_LEN + 1];
 
-	strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN);
+	snprintf(debugfs_dir_name, sizeof(debugfs_dir_name),
+		 "adf7242-%s", dev_name(&lp->spi->dev));
 
 	lp->debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux