summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c4
-rw-r--r--src/util/string.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c
index bc7c28b..997a53c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -7,6 +7,7 @@
#include <string.h>
#include <strings.h>
#include <unistd.h>
+#include <stdint.h>
/******************************************************************************/
@@ -118,8 +119,7 @@ void sk_config_cpy(struct sk_config *restrict dest, const struct sk_config *rest
size_t last = 0;
while (src->global.conf_dir[last] != NULL) last++;
last--;
- char *end = src->global.conf_dir[last] + strlen(src->global.conf_dir[last]);
- size_t bufsz = (void *)end - (void *)src->global.conf_dir;
+ size_t bufsz = ((uintptr_t)src->global.conf_dir[last] - (uintptr_t)src->global.conf_dir) + strlen(src->global.conf_dir[last]) * sizeof(char);
void *dbuf = malloc(bufsz);
memcpy(dbuf, src->global.conf_dir, bufsz);
diff --git a/src/util/string.c b/src/util/string.c
index d5ad73b..c760b06 100644
--- a/src/util/string.c
+++ b/src/util/string.c
@@ -4,6 +4,8 @@
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
+
#ifndef HAVE_STRDUP
char *strdup(const char *s) {
if (NULL == s) {
@@ -143,12 +145,12 @@ size_t strsplit(const char *restrict in, const char *restrict sep, void *buf) {
if (arr) {
/* update array pointers */
for (int j = 0; j < i; j++) {
- arr[j] = (char *)((size_t)buf + strtokoffset + (size_t)arr[j]);
+ arr[j] = (char *)((uintptr_t)buf + strtokoffset + (size_t)arr[j]);
}
arr[i] = NULL; /* NULL termination */
/* copy tokenized string from tmp to the back of buf */
- (void)memcpy(buf + strtokoffset, tmp, strtoklen);
+ (void)memcpy((void *)((uintptr_t)buf + strtokoffset), tmp, strtoklen);
}
free(tmp);