diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2021-01-23 08:44:00 -0700 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2021-01-23 08:44:00 -0700 |
commit | 7b9681b19cfec265df3cbfc190e9516c61556702 (patch) | |
tree | 898b5ba96c36c3ca8d21231faced44980e328ed2 | |
parent | 6626e69ecb6ad0261d2e1367bf926c7dc69ef86e (diff) | |
download | sudo-7b9681b19cfec265df3cbfc190e9516c61556702.tar.gz |
Fix the memset offset when converting a v1 timestamp to TS_LOCKEXCL.
We want to zero the struct starting at flags, not type (which was just set).
Found by Qualys.
-rw-r--r-- | plugins/sudoers/timestamp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/sudoers/timestamp.c b/plugins/sudoers/timestamp.c index d315723af..515eadd79 100644 --- a/plugins/sudoers/timestamp.c +++ b/plugins/sudoers/timestamp.c @@ -652,8 +652,8 @@ timestamp_lock(void *vcookie, struct passwd *pw) } else if (entry.type != TS_LOCKEXCL) { /* Old sudo record, convert it to TS_LOCKEXCL. */ entry.type = TS_LOCKEXCL; - memset((char *)&entry + offsetof(struct timestamp_entry, type), 0, - nread - offsetof(struct timestamp_entry, type)); + memset((char *)&entry + offsetof(struct timestamp_entry, flags), 0, + nread - offsetof(struct timestamp_entry, flags)); if (ts_write(cookie->fd, cookie->fname, &entry, 0) == -1) debug_return_bool(false); } |