diff options
author | Michael Brown <mcb30@ipxe.org> | 2013-07-15 18:06:41 +0200 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2013-07-15 18:06:41 +0200 |
commit | e52c24492af3465657fef882e15da9bc80e3512a (patch) | |
tree | f9c473c658ffa95bd8becc19096543c4c935ea20 /src/image | |
parent | 30de9e8300e97c4b56e29f5a3b08e4615b30606f (diff) | |
download | ipxe-e52c24492af3465657fef882e15da9bc80e3512a.tar.gz |
[script] Avoid trying to read final character of a zero-length string
Detected using Valgrind.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/script.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/image/script.c b/src/image/script.c index 8ef058545..ceccd9018 100644 --- a/src/image/script.c +++ b/src/image/script.c @@ -92,11 +92,11 @@ static int process_script ( struct image *image, script_offset += ( frag_len + 1 ); /* Strip trailing CR, if present */ - if ( line[ len - 1 ] == '\r' ) + if ( len && ( line[ len - 1 ] == '\r' ) ) len--; /* Handle backslash continuations */ - if ( line[ len - 1 ] == '\\' ) { + if ( len && ( line[ len - 1 ] == '\\' ) ) { len--; rc = -EINVAL; continue; |