hexdecoct: make unbase64mem and unhexmem always use SIZE_MAX

This commit is contained in:
Mike Yuan
2024-01-09 03:59:15 +09:00
committed by Yu Watanabe
parent 7f13af72f8
commit bdd2036e81
39 changed files with 86 additions and 84 deletions
+6 -6
View File
@@ -114,7 +114,7 @@ int unhexmem_full(
const char *p,
size_t l,
bool secure,
void **ret,
void **ret_data,
size_t *ret_len) {
_cleanup_free_ uint8_t *buf = NULL;
@@ -155,8 +155,8 @@ int unhexmem_full(
if (ret_len)
*ret_len = (size_t) (z - buf);
if (ret)
*ret = TAKE_PTR(buf);
if (ret_data)
*ret_data = TAKE_PTR(buf);
return 0;
}
@@ -766,7 +766,7 @@ int unbase64mem_full(
const char *p,
size_t l,
bool secure,
void **ret,
void **ret_data,
size_t *ret_size) {
_cleanup_free_ uint8_t *buf = NULL;
@@ -854,8 +854,8 @@ int unbase64mem_full(
if (ret_size)
*ret_size = (size_t) (z - buf);
if (ret)
*ret = TAKE_PTR(buf);
if (ret_data)
*ret_data = TAKE_PTR(buf);
return 0;
}
+6 -6
View File
@@ -18,9 +18,9 @@ char hexchar(int x) _const_;
int unhexchar(char c) _const_;
char *hexmem(const void *p, size_t l);
int unhexmem_full(const char *p, size_t l, bool secure, void **mem, size_t *len);
static inline int unhexmem(const char *p, size_t l, void **mem, size_t *len) {
return unhexmem_full(p, l, false, mem, len);
int unhexmem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size);
static inline int unhexmem(const char *p, void **ret_data, size_t *ret_size) {
return unhexmem_full(p, SIZE_MAX, false, ret_data, ret_size);
}
char base32hexchar(int x) _const_;
@@ -45,9 +45,9 @@ ssize_t base64_append(
size_t l,
size_t margin,
size_t width);
int unbase64mem_full(const char *p, size_t l, bool secure, void **mem, size_t *len);
static inline int unbase64mem(const char *p, size_t l, void **mem, size_t *len) {
return unbase64mem_full(p, l, false, mem, len);
int unbase64mem_full(const char *p, size_t l, bool secure, void **ret_data, size_t *ret_size);
static inline int unbase64mem(const char *p, void **ret_data, size_t *ret_size) {
return unbase64mem_full(p, SIZE_MAX, false, ret_data, ret_size);
}
void hexdump(FILE *f, const void *p, size_t s);