diff options
Diffstat (limited to 'src/utils/common.c')
-rw-r--r-- | src/utils/common.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/utils/common.c b/src/utils/common.c index 5cf0d571..e77b7db5 100644 --- a/src/utils/common.c +++ b/src/utils/common.c @@ -697,6 +697,29 @@ int is_hex(const u8 *data, size_t len) } +int has_ctrl_char(const u8 *data, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) { + if (data[i] < 32 || data[i] == 127) + return 1; + } + return 0; +} + + +int has_newline(const char *str) +{ + while (*str) { + if (*str == '\n' || *str == '\r') + return 1; + str++; + } + return 0; +} + + size_t merge_byte_arrays(u8 *res, size_t res_len, const u8 *src1, size_t src1_len, const u8 *src2, size_t src2_len) |