mirror of
https://git.proxmox.com/git/libgit2
synced 2025-10-19 03:00:09 +00:00
Repository: Fixed a bug in read_gitfile (proprely remove trailings newlines)
This commit is contained in:
parent
9d9bab5c38
commit
8b05e78018
@ -409,8 +409,8 @@ static int read_gitfile(char *path_out, size_t size, const char *file_path, cons
|
|||||||
|
|
||||||
end_offset = strlen(data) - 1;
|
end_offset = strlen(data) - 1;
|
||||||
|
|
||||||
for (;data[end_offset] != '\r' && data[end_offset] != '\n'; --end_offset);
|
for (;data[end_offset] == '\r' || data[end_offset] == '\n'; --end_offset);
|
||||||
data[end_offset] = '\0';
|
data[end_offset + 1] = '\0';
|
||||||
|
|
||||||
if (GIT_FILE_CONTENT_PREFIX_LENGTH == end_offset) {
|
if (GIT_FILE_CONTENT_PREFIX_LENGTH == end_offset) {
|
||||||
gitfo_free_buf(&file);
|
gitfo_free_buf(&file);
|
||||||
|
Loading…
Reference in New Issue
Block a user