jordansissel/xdotool — pull request #29 by calmofthestorm (2013-11-04 01:55:20+00:00)
Title: Fix handling of empty files in type command.

This pull request fixes a bug in type where passing an empty file (length 0), either a standard input or a file, results in an uninitialized buffer being typed. The issue arises because on a successful read of 0 bytes, fgets does not write a null to the destination buffer, but because the read was successful ferror will return 0. To reproduce:

touch empty_file
valgrind ./xdotool type --file empty_file