Sfoglia il codice sorgente

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 <[email protected]>
Signed-off-by: Hauke Mehrtens <[email protected]>
Hauke Mehrtens 3 anni fa
parent
commit
d80336e1a9
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      package/utils/busybox/patches/220-add_lock_util.patch

+ 1 - 1
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);
 +		}