From 1bb871e9be46a1b33cd1dd7a26927ecb7734062b Mon Sep 17 00:00:00 2001 From: XakerTwo <13261533+XakerTwo@users.noreply.github.com> Date: Mon, 17 Feb 2025 20:40:22 +0300 Subject: [PATCH 1/3] fix issue #15 - all is PE after first PE partially revert of d94ead34f504507ffd7c49b598995a77a951b385 additionally remove double OOM check ( ace9bbf25a0c0db899e750ac97d33212276fcc1f ) --- generate-cat-file.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/generate-cat-file.c b/generate-cat-file.c index 120b2df..3b1ea61 100644 --- a/generate-cat-file.c +++ b/generate-cat-file.c @@ -1088,7 +1088,7 @@ void parse_file_args(char **f_args, int f_count, char *os_attr, struct list_node struct list_node *this_file; struct a_file *file_data; int fname_len; - bool is_pe = false; + bool is_pe; *file = NULL; @@ -1123,6 +1123,8 @@ void parse_file_args(char **f_args, int f_count, char *os_attr, struct list_node is_pe = true; } + else + is_pe = false; this_file = malloc(sizeof(struct list_node) + sizeof(struct a_file)); if (this_file == NULL) { @@ -1165,10 +1167,6 @@ void parse_file_args(char **f_args, int f_count, char *os_attr, struct list_node //reverse order is based on observed cat files */ \ *hwid = malloc(sizeof(struct list_node) + sizeof(struct an_attribute_data)); \ if (*hwid == NULL) \ - { \ - fatal(ERR_OOM); \ - } \ - if (*hwid == NULL) \ { \ fatal(ERR_OOM); \ } \ From aad0f0bc37e1ea13a0234587e30e4dd6d17c5eae Mon Sep 17 00:00:00 2001 From: XakerTwo <13261533+XakerTwo@users.noreply.github.com> Date: Mon, 17 Feb 2025 23:08:06 +0300 Subject: [PATCH 2/3] fix typo in `.sh` that's cause first file passed as `HWID` when target hardware id(-s) was not passed to `.sh` - fallback value is used however, during #8 typo was introduced as a result - fallback value is in an incorrect and unused variable, while used variable remains empty --- gencat.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gencat.sh b/gencat.sh index f2f371b..52d4aca 100755 --- a/gencat.sh +++ b/gencat.sh @@ -65,7 +65,7 @@ function usage_and_exit() { EXEC_DIR=$( dirname $0 ) OUTPUT_CAT_FILE=- -HARDWARE_ID=windrbd +HARDWARE_IDS=windrbd OS_STRING=7X64,8X64,_v100_X64 OS_ATTR=2:6.1,2:6.2,2:10.0 GEN_TIME="-T 230823140713Z" From 3d555b8b6140859c9a3279b4ea4289ea39fd3c31 Mon Sep 17 00:00:00 2001 From: XakerTwo <13261533+XakerTwo@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:20:43 +0300 Subject: [PATCH 3/3] fix bug in the parser of the hwids argument when several delimiters follows one by one with no data between one of them would be captured as part of the hwid or as a separate hwid for example, ",hwid1,hwid2,," would be parsed as ",hwid1" "hwid2" "," bug occurred due to missing update of hwid_begin --- generate-cat-file.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/generate-cat-file.c b/generate-cat-file.c index 3b1ea61..897efc2 100644 --- a/generate-cat-file.c +++ b/generate-cat-file.c @@ -1189,7 +1189,7 @@ void parse_file_args(char **f_args, int f_count, char *os_attr, struct list_node hwid_data->value = hwid_begin; \ } -//note: it does modify hwids content (replace comma with null) and creates references to its particular parts +//note: it does modify hwids content (replace each comma, that comes 1st after hwid, with null) and creates references to its particular parts int parse_hwids_arg(char *hwids, struct list_node **hwid) { struct list_node *hwid_last = NULL; @@ -1199,13 +1199,17 @@ int parse_hwids_arg(char *hwids, struct list_node **hwid) while (*hwids) { - if (*hwids == ',' && hwids > hwid_begin) + if (*hwids == ',') { - FUNC_CREATE_HWID_NODE(); - - //"cut" string to current hwid end - *hwids = '\0'; - //update current position and move position of current hwid begin to it + //check if delimiter is NOT immediately after another one (empty entries must be skipped, delimiter is not allowed in the value) + if (hwids > hwid_begin) + { + FUNC_CREATE_HWID_NODE(); + + //"cut" string to current hwid end + *hwids = '\0'; + } + //update current position AND move position of current hwid begin to it hwid_begin = ++hwids; } else