Skip to content

Commit

Permalink
fix: Support for CRLF line endings in credentials and targets files (#35
Browse files Browse the repository at this point in the history
)
  • Loading branch information
matricali committed Aug 15, 2024
1 parent 0a901d7 commit 959c70c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void btkg_credentials_list_load(btkg_credentials_list_t *credentials_list,
}

for (int lines = 1; (read = getline(&temp, &len, fp)) != -1; lines++) {
temp[strcspn(temp, "\n")] = '\0';
temp[strcspn(temp, "\n\r")] = '\0';

btkg_credentials_t credentials;

Expand Down
2 changes: 1 addition & 1 deletion src/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void btkg_target_list_load(btkg_target_list_t *target_list,
int lines = 0;

while ((read = getline(&line, &len, fp)) != -1) {
strtok(line, "\n");
strtok(line, "\n\r");
btkg_target_t *ret = btkg_target_parse(line);

if (ret == NULL) {
Expand Down

0 comments on commit 959c70c

Please sign in to comment.