Skip to content

Commit 6c1fc4d

Browse files
committed
auparse: print_hook lookup moves internal cursor unexpectedly
1 parent 38a6e9e commit 6c1fc4d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

auparse/interpret.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3018,6 +3018,7 @@ static const char *print_hook(auparse_state_t *au, const char *val)
30183018
const char *str;
30193019
const char *fam;
30203020
int proto = -1;
3021+
unsigned int record, field;
30213022

30223023
errno = 0;
30233024
hook = strtoul(val, NULL, 16);
@@ -3027,14 +3028,17 @@ static const char *print_hook(auparse_state_t *au, const char *val)
30273028
return out;
30283029
}
30293030

3031+
record = auparse_get_record_num(au);
3032+
field = auparse_get_field_num(au);
30303033
fam = auparse_find_field(au, "family");
30313034
if (fam) {
30323035
errno = 0;
30333036
proto = strtoul(fam, NULL, 10);
30343037
if (errno)
30353038
proto = -1;
30363039
}
3037-
auparse_find_field(au, "hook");
3040+
if (auparse_goto_record_num(au, record))
3041+
auparse_goto_field_num(au, field);
30383042

30393043
if (proto == NFPROTO_ARP)
30403044
str = arphook_i2s(hook);

0 commit comments

Comments
 (0)