aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_add_algorithm.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-05-15 01:22:19 +0200
committerMattias Andrée <m@maandree.se>2026-05-15 01:22:19 +0200
commit68d6804a43dca2749a68a557e67b98e6005ead83 (patch)
tree9c4137a48cd37ea423578d1ac3df6e3953cb2156 /librecrypt_add_algorithm.c
parentFix minor errors in the test and check that we are not writing out of bounds (diff)
downloadlibrecrypt-68d6804a43dca2749a68a557e67b98e6005ead83.tar.gz
librecrypt-68d6804a43dca2749a68a557e67b98e6005ead83.tar.bz2
librecrypt-68d6804a43dca2749a68a557e67b98e6005ead83.tar.xz
Fix some minor issues
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_add_algorithm.c')
-rw-r--r--librecrypt_add_algorithm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/librecrypt_add_algorithm.c b/librecrypt_add_algorithm.c
index 920577d..4c6520e 100644
--- a/librecrypt_add_algorithm.c
+++ b/librecrypt_add_algorithm.c
@@ -67,8 +67,15 @@ librecrypt_add_algorithm(char *out_buffer, size_t size, const char *augend, cons
out_buffer[0u] = '\0';
}
} else {
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
if (!hashsize2)
goto out;
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
r_int = snprintf(NULL, 0u, "*%zu", hashsize2);
if (r_int < 2)
abort(); /* $covered$ (impossible reliably) */
@@ -126,7 +133,7 @@ librecrypt_add_algorithm(char *out_buffer, size_t size, const char *augend, cons
/* Chain the hash algorithms: write `augent` */
min = MIN(prefix1, size);
- if (out_buffer != augend)
+ if (out_buffer != augend && min)
memmove(out_buffer, augend, min);
out_buffer = &out_buffer[min];
size -= min;