diff options
author | Todd C. Miller <Todd.Miller@courtesan.com> | 2013-10-06 14:22:14 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@courtesan.com> | 2013-10-06 14:22:14 -0600 |
commit | 8953098253a8e12ebf49ecb0a240c7109518f712 (patch) | |
tree | 621fcf3bd6bc2efde746dfea0002a8bdc5e3b32f | |
parent | 41cf745aba1b32ee57a1d00b24e3904fe9636f5d (diff) | |
download | sudo-8953098253a8e12ebf49ecb0a240c7109518f712.tar.gz |
Fix removal of trailing newlines in a debug message.
-rw-r--r-- | common/sudo_debug.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/sudo_debug.c b/common/sudo_debug.c index 7652cf6fe..3f142ef02 100644 --- a/common/sudo_debug.c +++ b/common/sudo_debug.c @@ -339,12 +339,12 @@ sudo_debug_write_file(const char *func, const char *file, int lineno, iov[2].iov_base = sudo_debug_pidstr; iov[2].iov_len = sudo_debug_pidlen; - /* Add string along with newline if it doesn't have one. */ + /* Add string, trimming any trailing newlines. */ + while (len > 0 && str[len - 1] == '\n') + len--; if (len > 0) { iov[iovcnt].iov_base = (char *)str; iov[iovcnt].iov_len = len; - while (len > 0 && str[len - 1] == '\n') - iov[iovcnt].iov_len--; iovcnt++; } |