-/* $Id: chngproc.c,v 1.16 2021/07/12 15:09:20 beck Exp $ */
+/* $Id: chngproc.c,v 1.17 2022/05/05 19:51:35 florian Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
*/
#include <assert.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
goto out;
else if ((tok = readstr(netsock, COMM_TOK)) == NULL)
goto out;
+ else if (strlen(tok) < 1) {
+ warnx("token is too short");
+ goto out;
+ }
+
+ for (i = 0; tok[i]; ++i) {
+ int ch = (unsigned char)tok[i];
+ if (!isalnum(ch) && ch != '-' && ch != '_') {
+ warnx("token is not a valid base64url");
+ goto out;
+ }
+ }
if (asprintf(&fmt, "%s.%s", tok, th) == -1) {
warn("asprintf");
-/* $Id: main.c,v 1.54 2020/05/10 12:06:18 benno Exp $ */
+/* $Id: main.c,v 1.55 2022/05/05 19:51:35 florian Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
#include <ctype.h>
#include <err.h>
#include <libgen.h>
+#include <locale.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
struct domain_c *domain = NULL;
struct altname_c *ac;
+ if (setlocale(LC_CTYPE, "C") == NULL)
+ errx(1, "setlocale");
+
while ((c = getopt(argc, argv, "Fnrvf:")) != -1)
switch (c) {
case 'F':