summaryrefslogtreecommitdiff
path: root/csv.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-09-02 15:20:40 +0200
committerPeter Jones <pjones@redhat.com>2021-09-08 10:41:28 -0400
commit58e8dce449c8b0f1fb36c01de01fe7ed608f44d4 (patch)
tree09e04ec236e600fdcfc86113fc97c9160fa33320 /csv.c
parentecaf92ac2e34923b4b98e06e9d86e42ee18ae21f (diff)
downloadefi-boot-shim-58e8dce449c8b0f1fb36c01de01fe7ed608f44d4.tar.gz
efi-boot-shim-58e8dce449c8b0f1fb36c01de01fe7ed608f44d4.zip
test-csv: test handling of trailing NUL byte
Data after a NUL byte should be ignored. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Diffstat (limited to 'csv.c')
-rw-r--r--csv.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/csv.c b/csv.c
index 32780404..18460cd7 100644
--- a/csv.c
+++ b/csv.c
@@ -77,6 +77,7 @@ parse_csv_data(char *data, char *data_end, size_t n_columns, list_t *list)
end = data_end;
max = (uintptr_t)end - (uintptr_t)line + (end > line ? 1 : 0);
+ /* Skip the delimiter(s) of the previous line */
while (max && found) {
found = false;
for (delim = &delims[0]; max && *delim; delim++) {
@@ -87,6 +88,7 @@ parse_csv_data(char *data, char *data_end, size_t n_columns, list_t *list)
}
}
}
+ /* Find the first delimiter of the current line */
for (delim = &delims[0]; *delim; delim++) {
char *tmp = strnchrnul(line, max, *delim);
if (tmp < end)