X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Futils.c;h=8655e2beb848fd0ed81456ea650ac2180f174fb0;hb=1287fc13ccdf96cd18a391d53ce9b47c29b198e2;hp=5f40b8afac98ee4d891ed7b4f1961293f4eb8400;hpb=3d787920d51a35e74e442c7265be3b13b69ad8e4;p=tinc diff --git a/src/utils.c b/src/utils.c index 5f40b8af..8655e2be 100644 --- a/src/utils.c +++ b/src/utils.c @@ -138,7 +138,7 @@ size_t b64decode_tinc(const char *src, void *dst, size_t length) { unsigned char *udst = (unsigned char *)dst; for(i = 0; i < length && src[i]; i++) { - triplet |= base64_decode[src[i] & 0xff] << (6 * (i & 3)); + triplet |= (uint32_t)(base64_decode[src[i] & 0xff] << (6 * (i & 3))); if((i & 3) == 3) { if(triplet & 0xff000000U) { @@ -373,3 +373,7 @@ FILE *fopenmask(const char *filename, const char *mode, mode_t perms) { return f; } +bool string_eq(const char *first, const char *second) { + return !first == !second && + !(first && second && strcmp(first, second)); +}