diff --git a/rhizome_http.c b/rhizome_http.c index b098cff4..fb885665 100644 --- a/rhizome_http.c +++ b/rhizome_http.c @@ -380,6 +380,8 @@ static int strn_to_list_token(const char *str, uint64_t *rowidp, const char **af unsigned char token[sizeof rhizome_db_uuid.u.binary + sizeof *rowidp]; if (base64url_decode(token, sizeof token, str, 0, afterp, 0, NULL) != sizeof token) return 0; + if (cmp_uuid_t(&rhizome_db_uuid, (uuid_t *) &token) != 0) + return 0; memcpy(rowidp, token + sizeof rhizome_db_uuid.u.binary, sizeof *rowidp); return 1; } diff --git a/uuid.h b/uuid.h index 7609edcf..fea11631 100644 --- a/uuid.h +++ b/uuid.h @@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include #include +#include #include "strbuf.h" #ifndef __SERVALDNA_UUID_H_INLINE @@ -73,6 +74,10 @@ enum uuid_version { UUID_VERSION_NAME_SHA1 = 5 }; +__SERVALDNA_UUID_H_INLINE int cmp_uuid_t(const uuid_t *a, const uuid_t *b) { + return memcmp(a->u.binary, b->u.binary, sizeof a->u.binary); +} + __SERVALDNA_UUID_H_INLINE int uuid_is_valid(const uuid_t *any_uuid) { return (any_uuid->u.record.clock_seq_hi_and_reserved & 0xc0) == 0x80; }