ext/load.c in rjb-1.2.4 vs ext/load.c in rjb-1.2.5

- old
+ new

@@ -146,15 +146,23 @@ { jh = DEFAULT_HOME; } else { - if (strlen(jh) > HOME_NAME_LEN - && strcasecmp(jh + strlen(jh) - HOME_NAME_LEN, HOME_NAME) == 0) + if (strlen(jh) > HOME_NAME_LEN) { - char* p = ALLOCA_N(char, strlen(jh) + 8); - sprintf(p, "%s/..", jh); - jh = p; + int len = strlen(jh); + char* p = ALLOCA_N(char, len + 8); + jh = strcpy(p, jh); + if (*(jh + len - 1) == '/') + { + --len; + *(jh + len) = '\0'; + } + if (strcasecmp(jh + len - HOME_NAME_LEN, HOME_NAME) == 0) + { + strcpy(p + len, "/.."); + } } } #endif if (!jh) {