Compare commits
No commits in common. "2edc4942163fa12b5c5da5427cbe01ad87ff8dc4" and "c2c193f79a1be094f42d548ace0390472075b963" have entirely different histories.
2edc494216
...
c2c193f79a
|
@ -13,7 +13,6 @@
|
||||||
size_t page_size(void) _pure_;
|
size_t page_size(void) _pure_;
|
||||||
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
|
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
|
||||||
#define PAGE_ALIGN_DOWN(l) ((l) & ~(page_size() - 1))
|
#define PAGE_ALIGN_DOWN(l) ((l) & ~(page_size() - 1))
|
||||||
#define PAGE_OFFSET(l) ((l) & (page_size() - 1))
|
|
||||||
|
|
||||||
/* Normal memcpy requires src to be nonnull. We do nothing if n is 0. */
|
/* Normal memcpy requires src to be nonnull. We do nothing if n is 0. */
|
||||||
static inline void memcpy_safe(void *dst, const void *src, size_t n) {
|
static inline void memcpy_safe(void *dst, const void *src, size_t n) {
|
||||||
|
|
|
@ -451,7 +451,7 @@ int bus_message_from_header(
|
||||||
if (!IN_SET(h->version, 1, 2))
|
if (!IN_SET(h->version, 1, 2))
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
|
|
||||||
if (h->type == _SD_BUS_MESSAGE_TYPE_INVALID)
|
if (h->type <= _SD_BUS_MESSAGE_TYPE_INVALID || h->type >= _SD_BUS_MESSAGE_TYPE_MAX)
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
|
|
||||||
if (!IN_SET(h->endian, BUS_LITTLE_ENDIAN, BUS_BIG_ENDIAN))
|
if (!IN_SET(h->endian, BUS_LITTLE_ENDIAN, BUS_BIG_ENDIAN))
|
||||||
|
@ -589,8 +589,7 @@ _public_ int sd_bus_message_new(
|
||||||
assert_return(bus = bus_resolve(bus), -ENOPKG);
|
assert_return(bus = bus_resolve(bus), -ENOPKG);
|
||||||
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
|
assert_return(bus->state != BUS_UNSET, -ENOTCONN);
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
/* Creation of messages with _SD_BUS_MESSAGE_TYPE_INVALID is allowed. */
|
assert_return(type > _SD_BUS_MESSAGE_TYPE_INVALID && type < _SD_BUS_MESSAGE_TYPE_MAX, -EINVAL);
|
||||||
assert_return(type < _SD_BUS_MESSAGE_TYPE_MAX, -EINVAL);
|
|
||||||
|
|
||||||
sd_bus_message *t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
|
sd_bus_message *t = malloc0(ALIGN(sizeof(sd_bus_message)) + sizeof(struct bus_header));
|
||||||
if (!t)
|
if (!t)
|
||||||
|
@ -3022,7 +3021,7 @@ int bus_body_part_map(struct bus_body_part *part) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
shift = PAGE_OFFSET(part->memfd_offset);
|
shift = part->memfd_offset - ((part->memfd_offset / page_size()) * page_size());
|
||||||
psz = PAGE_ALIGN(part->size + shift);
|
psz = PAGE_ALIGN(part->size + shift);
|
||||||
|
|
||||||
if (part->memfd >= 0)
|
if (part->memfd >= 0)
|
||||||
|
@ -3159,8 +3158,7 @@ static struct bus_body_part* find_part(sd_bus_message *m, size_t index, size_t s
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
*p = part->data ? (uint8_t*) part->data + index - begin
|
*p = (uint8_t*) part->data + index - begin;
|
||||||
: NULL; /* Avoid dereferencing a NULL pointer. */
|
|
||||||
|
|
||||||
m->cached_rindex_part = part;
|
m->cached_rindex_part = part;
|
||||||
m->cached_rindex_part_begin = begin;
|
m->cached_rindex_part_begin = begin;
|
||||||
|
@ -5499,6 +5497,9 @@ int bus_message_parse_fields(sd_bus_message *m) {
|
||||||
if (m->reply_cookie == 0 || !m->error.name)
|
if (m->reply_cookie == 0 || !m->error.name)
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
assert_not_reached("Bad message type");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Refuse non-local messages that claim they are local */
|
/* Refuse non-local messages that claim they are local */
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue