[openwrt/openwrt] busybox: Fix snprintf arguments in lock

LEDE Commits lede-commits at lists.infradead.org
Thu Mar 31 09:58:47 PDT 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/d80336e1a970b088c235dcf2773052537e6f5d72

commit d80336e1a970b088c235dcf2773052537e6f5d72
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Thu Mar 31 18:43:09 2022 +0200

    busybox: Fix snprintf arguments in lock
    
    The first argument for snprintf is the buffer and the 2. one is the
    size. Fix the order. This broke the lock application.
    
    Fixes: 34567750db2c ("busybox: fix busybox lock applet pidstr buffer overflow")
    Reported-by: Hartmut Birr <e9hack at gmail.com>
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/utils/busybox/patches/220-add_lock_util.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/utils/busybox/patches/220-add_lock_util.patch b/package/utils/busybox/patches/220-add_lock_util.patch
index 623121b9fb..579b705f34 100644
--- a/package/utils/busybox/patches/220-add_lock_util.patch
+++ b/package/utils/busybox/patches/220-add_lock_util.patch
@@ -109,7 +109,7 @@
 +		if (!waitonly) {
 +			lseek(fd, 0, SEEK_SET);
 +			ftruncate(fd, 0);
-+			snprintf(sizeof(pidstr), pidstr, "%d\n", pid);
++			snprintf(pidstr, sizeof(pidstr), "%d\n", pid);
 +			write(fd, pidstr, strlen(pidstr));
 +			close(fd);
 +		}




More information about the lede-commits mailing list