pesign/0002-Fix-format-strings-for-32-bit-arches.patch
Robbie Harwood accbbe601f Fix explicit NULL deref when daemonizing
Resolves: #2049320
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2022-02-14 21:14:51 +00:00

113 lines
4.2 KiB
Diff

From df8783ed4ed87fef850268098690985049916ee9 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Tue, 1 Feb 2022 17:37:14 -0500
Subject: [PATCH 2/6] Fix format strings for 32-bit arches
Sadly, in 2022, this remains a thing.
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
---
src/cms_pe_common.c | 16 +++++++++-------
src/password.c | 7 ++++---
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/cms_pe_common.c b/src/cms_pe_common.c
index 964f0d9..3a3921b 100644
--- a/src/cms_pe_common.c
+++ b/src/cms_pe_common.c
@@ -49,7 +49,7 @@ check_pointer_and_size(cms_context *cms, Pe *pe, void *ptr, size_t size)
if (p + size > m + map_size)
cmsreterr(0, cms,
- "pointer %p is above mmap end at %p (%lu is %lu bytes past EOF at %lu)",
+ "pointer %p is above mmap end at %p (%lu is %lu bytes past EOF at %zu)",
(void *)((uintptr_t)p + size),
(void *)((uintptr_t)m + map_size),
p + size - m,
@@ -189,7 +189,7 @@ generate_digest(cms_context *cms, Pe *pe, int padded)
if (!check_pointer_and_size(cms, pe, hash_base, hash_size))
cmsgotoerr(error, cms, "PE header is invalid");
dprintf("beginning of hash");
- dprintf("digesting %lx + %lx", hash_base - map, hash_size);
+ dprintf("digesting %tx + %zx", hash_base - map, hash_size);
generate_digest_step(cms, hash_base, hash_size);
/* 5. Skip over the image checksum
@@ -209,7 +209,7 @@ generate_digest(cms_context *cms, Pe *pe, int padded)
cmsgotoerr(error, cms, "PE data directory is invalid");
generate_digest_step(cms, hash_base, hash_size);
- dprintf("digesting %lx + %lx", hash_base - map, hash_size);
+ dprintf("digesting %tx + %zx", hash_base - map, hash_size);
/* 8. Skip over the crt dir
* 9. Hash everything up to the end of the image header. */
@@ -222,7 +222,7 @@ generate_digest(cms_context *cms, Pe *pe, int padded)
cmsgotoerr(error, cms, "PE relocations table is invalid");
generate_digest_step(cms, hash_base, hash_size);
- dprintf("digesting %lx + %lx", hash_base - map, hash_size);
+ dprintf("digesting %tx + %zx", hash_base - map, hash_size);
/* 10. Set SUM_OF_BYTES_HASHED to the size of the header. */
hashed_bytes = pe32opthdr ? pe32opthdr->header_size
@@ -265,7 +265,7 @@ generate_digest(cms_context *cms, Pe *pe, int padded)
}
generate_digest_step(cms, hash_base, hash_size);
- dprintf("digesting %lx + %lx", hash_base - map, hash_size);
+ dprintf("digesting %tx + %zx", hash_base - map, hash_size);
hashed_bytes += hash_size;
}
@@ -285,10 +285,12 @@ generate_digest(cms_context *cms, Pe *pe, int padded)
memset(tmp_array, '\0', tmp_size);
memcpy(tmp_array, hash_base, hash_size);
generate_digest_step(cms, tmp_array, tmp_size);
- dprintf("digesting %lx + %lx", (unsigned long)tmp_array, tmp_size);
+ dprintf("digesting %tx + %zx", (ptrdiff_t)tmp_array,
+ tmp_size);
} else {
generate_digest_step(cms, hash_base, hash_size);
- dprintf("digesting %lx + %lx", hash_base - map, hash_size);
+ dprintf("digesting %tx + %zx", hash_base - map,
+ hash_size);
}
}
dprintf("end of hash");
diff --git a/src/password.c b/src/password.c
index 644f362..05add9a 100644
--- a/src/password.c
+++ b/src/password.c
@@ -213,7 +213,7 @@ parse_pwfile_line(char *start, struct token_pass *tp)
dprintf("non-whitespace span is %zd", span);
if (line[span] == '\0') {
- dprintf("returning %ld", (line + span) - start);
+ dprintf("returning %td", (line + span) - start);
return (line + span) - start;
}
line[span] = '\0';
@@ -241,7 +241,7 @@ parse_pwfile_line(char *start, struct token_pass *tp)
dprintf("Setting token pass %p to { %p, %p }", tp, tp->token, tp->pass);
dprintf("token:\"%s\"", tp->token);
dprintf("pass:\"%s\"", tp->pass);
- dprintf("returning %ld", (line + span) - start);
+ dprintf("returning %td", (line + span) - start);
return (line + span) - start;
}
@@ -330,7 +330,8 @@ SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
if (c != '\0')
span++;
start += span;
- dprintf("start is file[%ld] == '\\x%02hhx'", start - file, start[0]);
+ dprintf("start is file[%td] == '\\x%02hhx'", start - file,
+ start[0]);
}
qsort(phrases, nphrases, sizeof(struct token_pass), token_pass_cmp);
--
2.34.1