From 959c70c26f8c2f2d34e5b5e0198ec8118f745c06 Mon Sep 17 00:00:00 2001 From: Jorge Matricali Date: Thu, 15 Aug 2024 19:39:02 -0300 Subject: [PATCH] fix: Support for CRLF line endings in credentials and targets files (#35) --- src/credentials.c | 2 +- src/target.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/credentials.c b/src/credentials.c index a216859..4ace71d 100644 --- a/src/credentials.c +++ b/src/credentials.c @@ -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; diff --git a/src/target.c b/src/target.c index 10f30b8..1b5b002 100644 --- a/src/target.c +++ b/src/target.c @@ -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) {