diff options
Diffstat (limited to 'gril/parcel.c')
-rw-r--r-- | gril/parcel.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gril/parcel.c b/gril/parcel.c index 1cd8c8ee..96e3fbb4 100644 --- a/gril/parcel.c +++ b/gril/parcel.c @@ -200,6 +200,27 @@ char *parcel_r_string(struct parcel *p) return ret; } +void parcel_skip_string(struct parcel *p) +{ + int len16 = parcel_r_int32(p); + int strbytes; + + if (p->malformed) + return; + + /* This is how a null string is sent */ + if (len16 < 0) + return; + + strbytes = PAD_SIZE((len16 + 1) * sizeof(char16_t)); + if (p->offset + strbytes > p->size) { + p->malformed = 1; + return; + } + + p->offset += strbytes; +} + int parcel_w_raw(struct parcel *p, const void *data, size_t len) { if (data == NULL) { |