From 1b7604e5cb4eb7dfa76d6a31474165e173fbfdad Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 9 Jan 2023 14:16:59 -0700 Subject: [PATCH] sudo_lbuf_print: no longer need to check for lbuf->len > 0. Now that lbuf length is unsigned the earlier check for len == 0 is sufficient. --- lib/util/lbuf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/util/lbuf.c b/lib/util/lbuf.c index 0a258b2fc..101982065 100644 --- a/lib/util/lbuf.c +++ b/lib/util/lbuf.c @@ -288,12 +288,10 @@ sudo_lbuf_print_v1(struct sudo_lbuf *lbuf) /* For very small widths just give up... */ len = lbuf->continuation ? strlen(lbuf->continuation) : 0; if (lbuf->cols <= lbuf->indent + len + 20) { - if (lbuf->len > 0) { - lbuf->buf[lbuf->len] = '\0'; - lbuf->output(lbuf->buf); - if (lbuf->buf[lbuf->len - 1] != '\n') - lbuf->output("\n"); - } + lbuf->buf[lbuf->len] = '\0'; + lbuf->output(lbuf->buf); + if (lbuf->buf[lbuf->len - 1] != '\n') + lbuf->output("\n"); goto done; }