Your message dated Sat, 7 Sep 2019 02:55:28 +0200
with message-id <[email protected]>
and subject line mtd-utils: mtd_debug does not check amount of data read
has caused the Debian Bug report #793783,
regarding mtd-utils: mtd_debug does not check amount of data read
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
793783: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793783
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mtd-utils
Version: 1:1.5.1-1.1rck1
Severity: normal

Hello,

the kernel refuses to read more data from a MTD device than the device
size. However, mtd_debug does not check the amount of data read as
returned by read(2) and assumes the requested amount is always read when
there is no error. Reading 8M data from a 4M flash chip results in 8M
file containing the flash data at the start.

Attaching patch to fix the issue.

Thanks

Michal

-- System Information:
Debian Release: 8.1
  APT prefers stable
  APT policy: (900, 'stable'), (510, 'unstable'), (505, 'experimental'), (500, 
'oldstable')
Architecture: armhf (armv7l)
Foreign Architectures: i386

Kernel: Linux 4.2.0-rc3-00168-gf94f5ae (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages mtd-utils depends on:
ii  libc6      2.19-18
ii  liblzo2-2  2.08-1.2
ii  libuuid1   2.25.2-6
ii  zlib1g     1:1.2.8.dfsg-2+b1

mtd-utils recommends no packages.

mtd-utils suggests no packages.

-- no debconf information
Index: mtd-utils-1.5.1/mtd_debug.c
===================================================================
--- mtd-utils-1.5.1.orig/mtd_debug.c	2015-07-27 15:31:52.143449285 +0200
+++ mtd-utils-1.5.1/mtd_debug.c	2015-07-27 15:32:12.153449294 +0200
@@ -141,7 +141,10 @@
 			perror("read()");
 			goto err2;
 		}
-		err = write(outfd, buf, size);
+		if (err < size) {
+			fprintf(stderr, "%s: short read, requested %#x, read %#x\n", __func__, size, err);
+		}
+		err = write(outfd, buf, err);
 		if (err < 0) {
 			fprintf(stderr, "%s: write, size %#x, n %#x\n", __func__, size, n);
 			perror("write()");

--- End Message ---
--- Begin Message ---
Package: mtd-utils
Version: 1:2.0.0-1

The patch was included upstream and is available since stretch.

--- End Message ---

Reply via email to