On Mon 11 19 15:25 PM, Nikolay Sivov wrote:
On 11/19/18 6:11 AM, Zhiyi Zhang wrote:
+ length = strlenW(path); + if (length + 1 > PATHCCH_MAX_CCH) + { + *extension = NULL; + return E_INVALIDARG; + }
This doesn't look right. If it takes buffer length, that's the limit we should use. So if you have to iterate you should probably stop at this give limit.
Right. Thanks. We also need to implement StringCchLengthW and friends instead of using strlenW to avoid buffer overrun.
+ next = path; + while (*next) + { + if (*next == '\' || *next == ' ') + lastpoint = NULL; + else if (*next == '.') + lastpoint = next; + next++; + }
We'll need a test for size < length, and probably for forward slash too.
+ if (!pPathCchFindExtension) + { + win_skip("PathCchFindExtension() is not available.\n"); + return; + }
Maybe we can get rid of this, because it will never trigger if kernelbase is available. Probably 'hmod' check is enough to skip everything.