diff options
author | Denis Kenzior <denkenz@gmail.com> | 2015-11-19 16:29:22 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2015-11-30 10:53:48 -0600 |
commit | 2d694836a66c678cbde2a9299baa721158690b0b (patch) | |
tree | 495301f65813bb7e4eb06f411f810be3247f37fd /gril/parcel.c | |
parent | 4717227603a1bf57e8bee52ac87efc7ec59a59b9 (diff) | |
download | ofono-2d694836a66c678cbde2a9299baa721158690b0b.tar.bz2 |
gril: Add parcel skip string
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) { |