mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
Revert "busybox: fix busybox lock applet pidstr buffer overflow (#9163)"
This reverts commit e9c3781bb9
.
This commit is contained in:
parent
624a9f9703
commit
d17bbf492d
@ -72,9 +72,9 @@
|
|||||||
+
|
+
|
||||||
+static int do_lock(void)
|
+static int do_lock(void)
|
||||||
+{
|
+{
|
||||||
+ pid_t pid;
|
+ int pid;
|
||||||
+ int flags;
|
+ 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 | O_CREAT | O_EXCL, 0700)) < 0) {
|
||||||
+ if ((fd = open(file, O_RDWR)) < 0) {
|
+ if ((fd = open(file, O_RDWR)) < 0) {
|
||||||
@ -109,7 +109,7 @@
|
|||||||
+ if (!waitonly) {
|
+ if (!waitonly) {
|
||||||
+ lseek(fd, 0, SEEK_SET);
|
+ lseek(fd, 0, SEEK_SET);
|
||||||
+ ftruncate(fd, 0);
|
+ ftruncate(fd, 0);
|
||||||
+ snprintf(sizeof(pidstr), pidstr, "%d\n", pid);
|
+ sprintf(pidstr, "%d\n", pid);
|
||||||
+ write(fd, pidstr, strlen(pidstr));
|
+ write(fd, pidstr, strlen(pidstr));
|
||||||
+ close(fd);
|
+ close(fd);
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
Reference in New Issue
Block a user