"Alex Riesen" <raa.lkml@xxxxxxxxx> writes: >> >> Consolidating two of your patches, would this be Ok? >> > >> > Yes, but you may consider replacing strncpy with strlcpy: >> > >> >> + memcpy(dir_buffer, dir, len - suffix_len); >> >> + dir_buffer[len - suffix_len] = '\0'; >> > >> > strlcpy(dir_buffer, dir, len - suffix_len + 1); >> >> Does that buy us that much? Before going to that codepath, we >> have made sure the result fits, haven't we? I sense you haven't read my replacement patch (Dscho Acked it). I am talking about this part: + if (len > suffix_len && + !strcmp(dir + len - suffix_len, "/" DEFAULT_GIT_DIR_ENVIRONMENT)) { + if ((len - suffix_len) >= sizeof(dir_buffer)) + die("directory name too long"); + memcpy(dir_buffer, dir, len - suffix_len); + dir_buffer[len - suffix_len] = '\0'; - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html