summaryrefslogtreecommitdiffstats
path: root/gl/base64.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/base64.c')
-rw-r--r--gl/base64.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gl/base64.c b/gl/base64.c
index c8b3b76b..8a0edd4a 100644
--- a/gl/base64.c
+++ b/gl/base64.c
@@ -1,5 +1,5 @@
1/* base64.c -- Encode binary data using printable characters. 1/* base64.c -- Encode binary data using printable characters.
2 Copyright (C) 1999-2001, 2004-2006, 2009-2024 Free Software Foundation, Inc. 2 Copyright (C) 1999-2001, 2004-2006, 2009-2025 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -48,7 +48,7 @@
48/* Get imalloc. */ 48/* Get imalloc. */
49#include <ialloc.h> 49#include <ialloc.h>
50 50
51#include <intprops.h> 51#include <stdckdint.h>
52 52
53#include <string.h> 53#include <string.h>
54 54
@@ -59,7 +59,7 @@ to_uchar (char ch)
59 return ch; 59 return ch;
60} 60}
61 61
62static const char b64c[64] = 62static const char b64c[64] _GL_ATTRIBUTE_NONSTRING =
63 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 63 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
64 64
65/* Base64 encode IN array of size INLEN into OUT array. OUT needs 65/* Base64 encode IN array of size INLEN into OUT array. OUT needs
@@ -148,7 +148,7 @@ base64_encode_alloc (const char *in, idx_t inlen, char **out)
148 Treat negative INLEN as overflow, for better compatibility with 148 Treat negative INLEN as overflow, for better compatibility with
149 pre-2021-08-27 API, which used size_t. */ 149 pre-2021-08-27 API, which used size_t. */
150 idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen; 150 idx_t in_over_3 = inlen / 3 + (inlen % 3 != 0), outlen;
151 if (! INT_MULTIPLY_OK (in_over_3, 4, &outlen) || inlen < 0) 151 if (ckd_mul (&outlen, in_over_3, 4) || inlen < 0)
152 { 152 {
153 *out = NULL; 153 *out = NULL;
154 return 0; 154 return 0;