diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-15 01:22:19 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-15 01:22:19 +0200 |
| commit | 68d6804a43dca2749a68a557e67b98e6005ead83 (patch) | |
| tree | 9c4137a48cd37ea423578d1ac3df6e3953cb2156 /librecrypt_realise_salts.c | |
| parent | Fix minor errors in the test and check that we are not writing out of bounds (diff) | |
| download | librecrypt-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_realise_salts.c')
| -rw-r--r-- | librecrypt_realise_salts.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/librecrypt_realise_salts.c b/librecrypt_realise_salts.c index 8a4b769..8f6d4eb 100644 --- a/librecrypt_realise_salts.c +++ b/librecrypt_realise_salts.c @@ -50,7 +50,8 @@ librecrypt_realise_salts(char *restrict out_buffer, size_t size, const char *set /* Copy text before next '*' */ for (i = 0u; settings[i] != '*'; i++); min = MIN(i, size); - memcpy(out_buffer, settings, min); + if (min) + memcpy(out_buffer, settings, min); out_buffer = &out_buffer[min]; size -= min; settings = &settings[i]; @@ -136,7 +137,8 @@ librecrypt_realise_salts(char *restrict out_buffer, size_t size, const char *set if (settings[i++] == LIBRECRYPT_ALGORITHM_LINK_DELIMITER) break; min = MIN(i, size); - memcpy(out_buffer, settings, min); + if (min) + memcpy(out_buffer, settings, min); out_buffer = &out_buffer[min]; size -= min; settings = &settings[i]; |
