Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/util/getdelim.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ sudo_getdelim(char ** restrict buf, size_t * restrict bufsize, int delim,

do {
if (cp + 1 >= ep) {
const size_t used = (size_t)(cp - *buf);
char *newbuf = reallocarray(*buf, *bufsize, 2);
if (newbuf == NULL)
goto bad;
*bufsize *= 2;
cp = newbuf + (cp - *buf);
cp = newbuf + used;
ep = newbuf + *bufsize;
*buf = newbuf;
}
Expand All @@ -70,7 +71,7 @@ sudo_getdelim(char ** restrict buf, size_t * restrict bufsize, int delim,
bad:
/* Error, push back what was read if possible. */
while (cp > *buf) {
if (ungetc(*cp--, fp) == EOF)
if (ungetc((unsigned char)*--cp, fp) == EOF)
break;
}
return -1;
Expand Down
6 changes: 4 additions & 2 deletions lib/util/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ sudo_json_open_object_v1(struct json_container *jsonc, const char *name)
debug_return_bool(false);

if (name != NULL) {
json_append_string(jsonc, name);
if (!json_append_string(jsonc, name))
debug_return_bool(false);
if (!json_append_buf(jsonc, jsonc->minimal ? ":{" : ": {"))
debug_return_bool(false);
} else {
Expand Down Expand Up @@ -280,7 +281,8 @@ sudo_json_open_array_v1(struct json_container *jsonc, const char *name)
debug_return_bool(false);

if (name != NULL) {
json_append_string(jsonc, name);
if (!json_append_string(jsonc, name))
debug_return_bool(false);
if (!json_append_buf(jsonc, jsonc->minimal ? ":[" : ": ["))
debug_return_bool(false);
} else {
Expand Down
7 changes: 0 additions & 7 deletions lib/util/term.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,6 @@ sudo_term_raw_v1(int fd, unsigned int flags)
goto unlock;
}

if (sudo_term_is_raw_int(&term)) {
sudo_debug_printf(SUDO_DEBUG_INFO, "%s: fd %d already in raw mode",
__func__, fd);
ret = true;
goto unlock;
}

/*
* Set terminal to raw mode but optionally enable terminal signals
* and/or preserve output flags.
Expand Down
Loading