Hi @ll,

reading the source <https://cvsweb.openbsd.org/src/lib/libc/stdio/vfwscanf.c>
I noticed that it fails to detect the premature end of the format string
inside a scanset, for example "%["

|     case '[':
|         ccls = fmt;
|         if (*fmt == '^') {
|             cclcompl = 1;
|             fmt++;
|         } else
|             cclcompl = 0;
|         if (*fmt == ']')
|             fmt++;
|         while (*fmt != '\0' && *fmt != ']')
                 ~~~~~~~~~~~~~~~
|             fmt++;
|         ccle = fmt;
|         fmt++;

Patch attached.

regards
Stefan

PS: the man page <https://man.openbsd.org/wscanf.3> tells for %[

| some implementations of wscanf() use “A-Z” to represent the range of
| characters between ‘A’ and ‘Z’.

    Since OpenBSD's *wscanf() functions don't support ranges the man page
    should better tell

| all implementations of wscanf() don't support “A-Z” to represent the
| range of characters between ‘A’ and ‘Z’.

Attachment: vfwscanf.patch
Description: Binary data

Reply via email to