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.
This commit is contained in:
@@ -643,8 +643,8 @@ timestamp_lock(void *vcookie, struct passwd *pw)
|
||||
if (entry.size == sizeof(struct timestamp_entry_v1)) {
|
||||
/* 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);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user