It occurred to me right after committing the previous change that it is
doing the same thing as valid_uri(). Calling it is simpler and the
additional "/." check won't hurt.

Index: main.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
retrieving revision 1.212
diff -u -p -r1.212 main.c
--- main.c      26 Aug 2022 11:04:13 -0000      1.212
+++ main.c      26 Aug 2022 11:47:47 -0000
@@ -674,7 +674,7 @@ load_skiplist(const char *slf)
        struct skiplistentry    *sle;
        FILE                    *fp;
        char                    *line = NULL;
-       size_t                   linesize = 0, linelen, s;
+       size_t                   linesize = 0, linelen;
 
        if ((fp = fopen(slf, "r")) == NULL) {
                if (errno == ENOENT && strcmp(slf, DEFAULT_SKIPLIST_FILE) == 0)
@@ -697,10 +697,8 @@ load_skiplist(const char *slf)
                linelen = strcspn(line, " #\r\n\t");
                line[linelen] = '\0';
 
-               for (s = 0; s < linelen; s++)
-                       if (!isalnum((unsigned char)line[s]) &&
-                           !ispunct((unsigned char)line[s]))
-                               errx(1, "invalid entry in skiplist: %s", line);
+               if (!valid_uri(line, linelen, NULL))
+                       errx(1, "invalid entry in skiplist: %s", line);
 
                if ((sle = malloc(sizeof(struct skiplistentry))) == NULL)
                        err(1, NULL);

Reply via email to