https://issues.apache.org/bugzilla/show_bug.cgi?id=54596

Konstantin Kolinko <knst.koli...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #7 from Konstantin Kolinko <knst.koli...@gmail.com> ---
Reviewing the code of native/iis/jk_isapi_plugin.c I have the following
comments

1). The skip_prefix() utility method can return a non-null value without
assigning any values to "sp" and "cp" pointers. It may result in crash in a
caller of that method.

Actually the "cp" value is never used by the callers of skip_prefix() method.
That argument can be removed.

Essentially, the skip_prefix() method returns two values:

1. The return value (path): Pointer to the first character after 'C:' or
'//share/' prefix.
2. sp: "start pointer", "start prefix"?  Pointer to the first valuable
character - the first character of 'C:' or '//share/' prefix, or the same as
the main return value if there is no prefix.


2). In relative_path():

[[[
                        while (cp > sp) {
]]]

Technically, the minimum value for "cp" is not sp, but the return value of
skip_prefix() call. If those are different then it means that the value if an
absolute path starting with "C:" or "//share/" prefix.

Actually that never happens in practice, because we never deal with an absolute
path here. All calls to path_merge() -> relative_path() are guarded by a
"is_path_relative()" condition.


3). In relative_path():

There is a while(nd > 1) loop. It provides support for n consecutive dots, as
supported on Unix.  On Windows the code supports only '.' or '..' dots. As
such, the loop can be simplified to a simple if(nd > 1).

(If instead of that one wants to implement support for relative paths with more
than 2 dots, then
 (*remain)++;
has to be replaced with
 (*remain)+=(nd-1);
)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to