summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Esser <besser82@fedoraproject.org>2021-08-05 13:27:07 +0200
committerBjörn Esser <besser82@fedoraproject.org>2021-08-05 13:48:35 +0200
commitf7bf4fad01ee6f4fb14f2d894d53abe2814ae801 (patch)
tree93066a10c9a5716c05cff6319c35b838af86b607
parent3ac49634ed5ee571f064dcf6018163a72bf3b4fc (diff)
downloadlibxcrypt-f7bf4fad01ee6f4fb14f2d894d53abe2814ae801.tar.gz
libxcrypt-f7bf4fad01ee6f4fb14f2d894d53abe2814ae801.tar.bz2
libxcrypt-f7bf4fad01ee6f4fb14f2d894d53abe2814ae801.zip
lib/util-base64.c: Explicitly terminate the c string.
Adding an explicit terminator at the end of the base64 character array will ensure it cannot be declared, nor defined in a too small size, which might omit the needed null byte at the end for proper termination of the c string.
-rw-r--r--lib/util-base64.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/util-base64.c b/lib/util-base64.c
index 3054fc6..d55461f 100644
--- a/lib/util-base64.c
+++ b/lib/util-base64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2018-2019 Björn Esser <besser82@fedoraproject.org>
+/* Copyright (C) 2018-2021 Björn Esser <besser82@fedoraproject.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
@@ -21,6 +21,7 @@
#include "crypt-port.h"
const unsigned char ascii64[65] =
- "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
/* 0000000000111111111122222222223333333333444444444455555555556666 */
/* 0123456789012345678901234567890123456789012345678901234567890123 */
+ "\x00";