summaryrefslogtreecommitdiffstats
path: root/text-utils/colcrt.c
Commit message (Collapse)AuthorAgeFilesLines
* colcrt: avoid the command getting hung [afl]Sami Kerola2016-04-131-0/+7
| | | | | | | Some inputs make getwc(3) not to progress file descriptor and neither to report EILSEQ. Detect such situation and skip the bad input. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* colcrt: minor cosmetic changesKarel Zak2016-02-111-14/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* colcrt: reimplementationSami Kerola2016-02-021-243/+176Star
| | | | | | | | | | This implementation aims to be easier to read, more robust dealing all sorts of unexpected inputs, and possibly even more correct. The correctness refers to last line handling this implementation does differently than the previous. With the previous last line that ended to EOF without \n was not printed. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* colcrt: allocate enough space for data moves [afl & asan]Sami Kerola2015-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ==2807==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000013a31f0 at pc 0x0000004e3047 bp 0x7fffcb7df8d0 sp 0x7fffcb7df8c8 READ of size 4 at 0x0000013a31f0 thread T0 #0 0x4e3046 in move /home/src/util-linux/text-utils/colcrt.c:309:13 #1 0x4e25b1 in pflush /home/src/util-linux/text-utils/colcrt.c:264:3 #2 0x4e246d in colcrt /home/src/util-linux/text-utils/colcrt.c:157:4 #3 0x4e17d4 in main /home/src/util-linux/text-utils/colcrt.c:141:3 #4 0x7fb0cb2ee60f in __libc_start_main (/usr/lib/libc.so.6+0x2060f) #5 0x4362c8 in _start (/home/src/util-linux/colcrt+0x4362c8) 0x0000013a31f0 is located 0 bytes to the right of global variable 'page' defined in 'text-utils/colcrt.c:73:9' (0x1380b40) of size 140976 SUMMARY: AddressSanitizer: global-buffer-overflow /home/src/util-linux/text-utils/colcrt.c:309 move And another crash: ==4578==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000013a3d24 at pc 0x0000004e2510 bp 0x7ffc9257b0e0 sp 0x7ffc9257b0d8 READ of size 4 at 0x0000013a3d24 thread T0 #0 0x4e250f in colcrt /home/src/util-linux/text-utils/colcrt.c:218:8 #1 0x4e17d4 in main /home/src/util-linux/text-utils/colcrt.c:141:3 #2 0x7fe0ac94160f in __libc_start_main (/usr/lib/libc.so.6+0x2060f) #3 0x4362c8 in _start (/home/src/util-linux/colcrt+0x4362c8) 0x0000013a3d24 is located 8 bytes to the right of global variable 'page' defined in 'text-utils/colcrt.c:73:9' (0x1381240) of size 142044 SUMMARY: AddressSanitizer: global-buffer-overflow /home/src/util-linux/text-utils/colcrt.c:218 colcrt Reported-by: Alaa Mubaied <alaamubaied@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* colcrt: avoid writing beyond array bound [afl & asan]Sami Kerola2015-08-101-0/+2
| | | | | | | | | | | | | | | text-utils/colcrt.c:205:10: runtime error: index -1 out of bounds for type 'wchar_t [133]' SUMMARY: AddressSanitizer: undefined-behavior text-utils/colcrt.c:205 ================================================================= ==2357==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000013811b0 at pc 0x0000004e2514 bp 0x7ffdf6ba4450 sp 0x7ffdf6ba4448 READ of size 4 at 0x0000013811b0 thread T0 #0 0x4e2513 in colcrt /home/src/util-linux/text-utils/colcrt.c:213:8 #1 0x4e17d4 in main /home/src/util-linux/text-utils/colcrt.c:139:3 #2 0x7fb77236960f in __libc_start_main (/usr/lib/libc.so.6+0x2060f) #3 0x4362c8 in _start (/home/src/util-linux/colcrt+0x4362c8) Reported-by: Alaa Mubaied <alaamubaied@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* colcrt: use #define in place of magic constantsSami Kerola2015-08-091-11/+14
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* colcrt: slice up the usage text for ease of translationBenno Schulenberg2015-01-061-8/+8
| | | | | | Also use the standard macros for outputting it. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: use manual tail usage() macroSami Kerola2014-10-011-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: use version printing macro everywhereSami Kerola2014-10-011-3/+1Star
| | | | | | | Only mount, umount, and blkid remains not using the macro because they are print also library references. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* mark expected fallthrough for static analysersKarel Zak2012-09-071-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* text-utils: verify writing to streams was successfulSami Kerola2012-04-041-2/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* colctr: use long options and clean coding styleSami Kerola2011-06-011-26/+64
| | | | | | This commit introduces help & version options. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* replace bcopy,bzero,index and rindexDaniel Mierswa2009-08-171-2/+2
| | | | | | | | | Those 4 functions are marked as LEGACY in POSIX.1-2001 and removed in POSIX.1-2008. Replaced with memmove,memset,strchr and strrchr. Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-78/+101
|
* Imported from util-linux-2.10f tarball.Karel Zak2006-12-071-17/+27
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-1/+10
|
* Imported from util-linux-2.9i tarball.Karel Zak2006-12-071-3/+4
|
* Imported from util-linux-2.8 tarball.Karel Zak2006-12-071-10/+0Star
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-12/+14
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+251