Commit 716bf4d6 authored by Peter Berg Larsen's avatar Peter Berg Larsen Committed by Alexandre Julliard

Elimination of lstrcpyn, and corrected a potential pointer bug.

parent f525f182
...@@ -35,15 +35,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); ...@@ -35,15 +35,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
static void module_fill_module(const char* in, char* out, unsigned size) static void module_fill_module(const char* in, char* out, unsigned size)
{ {
const char* ptr; const char *ptr,*endptr;
unsigned len; unsigned len;
for (ptr = in + strlen(in) - 1; endptr = in + strlen(in);
*ptr != '/' && *ptr != '\\' && ptr >= in; for (ptr = endptr - 1;
ptr >= in && *ptr != '/' && *ptr != '\\';
ptr--); ptr--);
if (ptr < in || *ptr == '/' || *ptr == '\\') ptr++; ptr++;
lstrcpynA(out, ptr, size); len = min(endptr-ptr,size-1);
len = strlen(out); memcpy(out, ptr, len);
out[len] = '\0';
if (len > 4 && if (len > 4 &&
(!strcasecmp(&out[len - 4], ".dll") || !strcasecmp(&out[len - 4], ".exe"))) (!strcasecmp(&out[len - 4], ".dll") || !strcasecmp(&out[len - 4], ".exe")))
out[len - 4] = '\0'; out[len - 4] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment