Ticket #1055 (new defect)
vformat expects data to be null-terminated
| Reported by: | Graham Cobb | Owned by: | cstender |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Format Plugin: vformat | Version: | 0.38 |
| Severity: | normal | Keywords: | |
| Cc: | dgollub |
Description
The vformat format plugin appears to expect data to be null-terminated strings. For example, conv_vcard_to_xmlformat is passed the input buffer address and length but it then just passes the address to vformat_new_from_string which expects it to be null-terminated.
In GPE, I supply report changes with the data and the string length. Thus there is no null terminator. As OSyncData structures include a length, I expect this to be used and not need a null terminator.
I think this is a bug in vformat (and possibly in many other plugins). Alternatively, OpenSync? could decide that the vformat format always requires a null terminator, in which case the bug is in GPE for reporting the change without including the null (do other plugins have the same problem)?

I also run into this problem [0] and I'm not sure which is the best fix. Some plugins use strlen+1 others use strlen and then in file-sync the data is corrupted. :-/
[0] http://www.nabble.com/invalid-read-of-size---broken-files-in-file-sync-to15962611.html#a15962611