diff options
author | Joel Sherrill <joel@rtems.org> | 2017-03-13 10:42:24 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2017-03-14 12:02:09 -0500 |
commit | c218d01d7a010f05878192a919cddccaf80394a0 (patch) | |
tree | 2a93037b24c2e00bf86af4efb33a1a096e32e9b3 | |
parent | libchip/serial/mc68681.c: Add error check (diff) | |
download | rtems-c218d01d7a010f05878192a919cddccaf80394a0.tar.bz2 |
tools/build/eolstrip.c: Use snprintf() to avoid potential buffer overflow
This was spotted by Coverity Scan.
-rw-r--r-- | tools/build/eolstrip.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/build/eolstrip.c b/tools/build/eolstrip.c index e93b45e906..091b06e47e 100644 --- a/tools/build/eolstrip.c +++ b/tools/build/eolstrip.c @@ -171,7 +171,9 @@ process(char *arg) error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg ); if ( !test_only ) { - sprintf( outname, "%s.eoltmp", arg ); + length = snprintf( outname, BUFFER_SIZE, "%s.eoltmp", arg ); + if (length >= BUFFER_SIZE) + error( ERR_ERRNO | ERR_FATAL, "Tmp file name too long\n" ); out = fopen( outname, "w" ); if (!out) |