bin/165988: pathchk -p does not work correctly with some locales
[PATCH}
Nicolas Rachinsky
nicolas-2012 at rachinsky.de
Mon Mar 12 22:50:15 UTC 2012
>Number: 165988
>Category: bin
>Synopsis: pathchk -p does not work correctly with some locales [PATCH}
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Mar 12 22:50:15 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Nicolas Rachinsky
>Release: 8.2-RELEASE-p5
>Organization:
>Environment:
same problem with env -i
>Description:
pathchk -p ignores codepoints >127 (and all unportable characters behind them). This error seems to be in the latest version in the repository as well.
portable() returns the invalid character. Since this is treated as signed, the check >=0 misses unportable characters, which are not in us-ascii but in ISO8859-15 or UTF-8.
>How-To-Repeat:
- Use e.g. ISO8859-15 or UTF-8 as input charset.
- execute: pathchk -p "/homeä/öön/foo/öbaör"
- observe: no error is returned
>Fix:
Patch attached with submission follows:
--- pathchk.c.orig 2012-03-12 23:37:55.000000000 +0100
+++ pathchk.c 2012-03-12 23:39:24.000000000 +0100
@@ -142,7 +142,7 @@
goto bad;
}
- if (pflag && (badch = portable(p)) >= 0) {
+ if (pflag && (badch = portable(p)) != 0) {
warnx("%s: %s: component contains non-portable "
"character `%c'", path, p, badch);
goto bad;
@@ -201,5 +201,5 @@
if (path[s] != '\0')
return (path[s]);
printf("bar:%s\n",path);
- return (-1);
+ return (0);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list