firmware-utils: uimage_padhdr: fix Coverity issue
authorPetr Štetiar <ynezz@true.cz>
Wed, 31 Jul 2019 12:07:11 +0000 (14:07 +0200)
committerPetr Štetiar <ynezz@true.cz>
Sun, 4 Aug 2019 20:09:20 +0000 (22:09 +0200)
commit2fc7a2712f44de68b0fade4badb07ce9ea07ed16
tree23cbf9b2f8aabd3343f41aa1a53506aa93508fe9
parentd37bf3bf0cc26902bd08d36894aa1d29fe57d0ae
firmware-utils: uimage_padhdr: fix Coverity issue

Fixes following issue reported by Coverity scan:

 *** CID 1452085:  Security best practices violations  (TOCTOU)
 /tools/firmware-utils/src/uimage_padhdr.c: 100 in main()
 94
 95      if (!infname || !outfname) {
 96      usage(argv[0]);
 97      exit(1);
 98      }
 99
 >>>     CID 1452085:  Security best practices violations  (TOCTOU)
 >>>     Calling function "stat" to perform check on "infname".
 100      if (stat(infname, &statbuf) < 0) {

Fixes: a1c6a316d299 ("ramips: add support for Fon FON2601")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
src/uimage_padhdr.c