--- old/src/windows/back/linker_md.c 2013-03-04 19:20:11.113722241 +0100 +++ new/src/windows/back/linker_md.c 2013-03-04 19:20:10.941722232 +0100 @@ -44,6 +44,7 @@ char *path_sep = PATH_SEPARATOR; char *pathname = (char *)pname; + *buffer = '\0'; while (strlen(pathname) > 0) { char *p = strchr(pathname, *path_sep); if (p == NULL) { @@ -54,16 +55,20 @@ continue; } if (*(p-1) == ':' || *(p-1) == '\\') { - (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), + (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname), pathname, fname); } else { - (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), + (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname), pathname, fname); } if (_access(buffer, 0) == 0) { break; } - pathname = p + 1; + if (*p == '\0') { + pathname = p; + } else { + pathname = p + 1; + } *buffer = '\0'; } }