mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
vmspawn: check overflow earlier
Follow-up for 862c68a914.
Fixes CID#1550749.
This commit is contained in:
@@ -626,10 +626,10 @@ static int read_vsock_notify(NotifyConnectionData *d, int fd) {
|
||||
if (n == 0) /* We hit EOF! Let's parse this */
|
||||
break;
|
||||
|
||||
d->full += n;
|
||||
|
||||
if (d->full >= sizeof(d->buffer))
|
||||
if ((size_t) n >= sizeof(d->buffer) - d->full)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EBADMSG), "Received notify message exceeded maximum size.");
|
||||
|
||||
d->full += n;
|
||||
}
|
||||
|
||||
/* We reached EOF, now parse the thing */
|
||||
|
||||
Reference in New Issue
Block a user