summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2023-02-20 16:16:01 +0100
committerNIIBE Yutaka <gniibe@fsij.org>2023-03-07 15:36:12 +0900
commit3fd3bb31597f80c76a94ea62e42d58d796beabf1 (patch)
tree3b07b367cb714754b03232722b317d47e21bcbd3
parent45b80678109e5817b7cd15566a9d6c96b064b95f (diff)
downloadlibgcrypt-3fd3bb31597f80c76a94ea62e42d58d796beabf1.tar.gz
fips: Check return value from ftell
* src/fips.c (get_file_offset): Check return value of ftell to be able to detect errors. -- Originally reported by coverity. Signed-off-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--src/fips.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fips.c b/src/fips.c
index 272aabae..0d89b6da 100644
--- a/src/fips.c
+++ b/src/fips.c
@@ -681,6 +681,8 @@ get_file_offset (FILE *fp, ElfW (Ehdr) *ehdr_p,
return gpg_error_from_syserror ();
off = ftell (fp);
+ if (off < 0)
+ return gpg_error_from_syserror ();
if (shdr.sh_type == SHT_NOTE && shdr.sh_flags == 0 && shdr.sh_size == 48)
{
const char header_of_the_note[] = {