diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2022-11-04 14:27:03 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2022-11-04 14:27:03 -0600 |
commit | 82f411f3a5142e5ece898d7167273baaf9f26685 (patch) | |
tree | 014766cad9d1e552941e77f35515ba7085588ac5 /plugins/sudoers/toke.l | |
parent | ea3f51a2d1188cca6be1a6820dd7d568dceed164 (diff) | |
parent | f685f3d8c52b65aa03a9beab9f7adca9456ea3f9 (diff) | |
download | sudo-SUDO_1_9_12p1.tar.gz |
Merge sudo 1.9.12p1 from tip.SUDO_1_9_12p1
Diffstat (limited to 'plugins/sudoers/toke.l')
-rw-r--r-- | plugins/sudoers/toke.l | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index c843162d3..2f062ff12 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -1367,8 +1367,9 @@ sudoers_trace_print(const char *msg) sudo_lbuf_append(&trace_lbuf, "%s", msg); if (strchr(msg, '\n') != NULL) { + /* We already parsed the newline so sudolineno is off by one. */ sudo_debug_printf2(NULL, NULL, 0, SUDOERS_DEBUG_PARSER|SUDO_DEBUG_DEBUG, - "%s:%d: %s", sudoers, sudolineno, trace_lbuf.buf); + "sudoerslex: %s:%d: %s", sudoers, sudolineno - 1, trace_lbuf.buf); trace_lbuf.len = 0; } return 0; @@ -1386,6 +1387,7 @@ sudoers_input(char *buf, yy_size_t max_size) { char *cp; size_t avail = sudolinebuf.len - sudolinebuf.off; + debug_decl(sudoers_input, SUDOERS_DEBUG_PARSER); /* Refill line buffer if needed. */ if (avail == 0) { @@ -1430,6 +1432,9 @@ sudoers_eof: sudolinebuf.buf[avail] = '\0'; } + sudo_debug_printf(SUDO_DEBUG_DEBUG, "%s:%d: %.*s", sudoers, sudolineno, + (int)(avail -1), sudolinebuf.buf); + sudolinebuf.len = avail; sudolinebuf.off = 0; sudolinebuf.toke_start = sudolinebuf.toke_end = 0; @@ -1440,5 +1445,5 @@ sudoers_eof: memcpy(buf, sudolinebuf.buf + sudolinebuf.off, avail); sudolinebuf.off += avail; - return avail; + debug_return_size_t(avail); } |