From 12bb86e678d3749e5b61e859b2e7cb47c0c6fe7e Mon Sep 17 00:00:00 2001 From: dmiller Date: Fri, 2 Dec 2022 21:57:31 +0000 Subject: [PATCH] Fix a couple off-by-one errors in parse_single_fingerprint --- osscan.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osscan.cc b/osscan.cc index 93e01c4e3..49dc1d219 100644 --- a/osscan.cc +++ b/osscan.cc @@ -930,8 +930,8 @@ FingerPrint *parse_single_fingerprint(const FingerPrintDB *DB, const char *fprin while (p < nextline && isspace((int) (unsigned char) *p)) p++; - q = nextline ? nextline : end; - while (q > p && isspace((int) (unsigned char) *q)) + q = nextline; + while (q > p && isspace((int) (unsigned char) *(q - 1))) q--; FP->match.OS_name = cp_strndup(p, q - p); @@ -965,7 +965,7 @@ FingerPrint *parse_single_fingerprint(const FingerPrintDB *DB, const char *fprin fatal("Parse error on line %d of fingerprint: %.*s\n", lineno, (int)(nextline - thisline), thisline); } - thisline = nextline; /* Time to handle the next line, if there is one */ + thisline = nextline + 1; /* Time to handle the next line, if there is one */ lineno++; } while (thisline && thisline < end);