From d17bbf492dc6d44691726d16f25a03cb8550921a Mon Sep 17 00:00:00 2001 From: lean Date: Fri, 1 Apr 2022 10:19:02 +0800 Subject: [PATCH] Revert "busybox: fix busybox lock applet pidstr buffer overflow (#9163)" This reverts commit e9c3781bb9f265fa0cad2bfacbfcf924f27ab908. --- package/utils/busybox/patches/220-add_lock_util.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/busybox/patches/220-add_lock_util.patch b/package/utils/busybox/patches/220-add_lock_util.patch index 623121b9f..4e46b74f0 100644 --- a/package/utils/busybox/patches/220-add_lock_util.patch +++ b/package/utils/busybox/patches/220-add_lock_util.patch @@ -72,9 +72,9 @@ + +static int do_lock(void) +{ -+ pid_t pid; ++ int pid; + int flags; -+ char pidstr[12]; ++ char pidstr[8]; + + if ((fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0700)) < 0) { + if ((fd = open(file, O_RDWR)) < 0) { @@ -109,7 +109,7 @@ + if (!waitonly) { + lseek(fd, 0, SEEK_SET); + ftruncate(fd, 0); -+ snprintf(sizeof(pidstr), pidstr, "%d\n", pid); ++ sprintf(pidstr, "%d\n", pid); + write(fd, pidstr, strlen(pidstr)); + close(fd); + }