When running
        hexdump -s $NUM file
where NUM is the size of the file, hexdump will print the entire file,
instead of skipping over the content.

"od -j $NUM" has the same issue.

Index: display.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/display.c,v
retrieving revision 1.21
diff -u -p -r1.21 display.c
--- display.c   16 Jan 2015 06:40:08 -0000      1.21
+++ display.c   8 Feb 2016 12:39:12 -0000
@@ -329,7 +326,7 @@ doskip(const char *fname, int statok)
                if (fstat(fileno(stdin), &sb))
                        err(1, "fstat %s", fname);
                if (S_ISREG(sb.st_mode)) {
-                       if (skip >= sb.st_size) {
+                       if (skip > sb.st_size) {
                                address += sb.st_size;
                                skip -= sb.st_size;
                        } else {

This bug was discovered by tdm.

-- 
Michal Mazurek

Reply via email to