Merge lp://staging/~cbehrens/agent-smith/short-read-fix into lp://staging/agent-smith
Proposed by
Chris Behrens
Status: | Merged |
---|---|
Merged at revision: | 70 |
Proposed branch: | lp://staging/~cbehrens/agent-smith/short-read-fix |
Merge into: | lp://staging/agent-smith |
Diff against target: |
57 lines (+14/-5) 1 file modified
src/spool.c (+14/-5) |
To merge this branch: | bzr merge lp://staging/~cbehrens/agent-smith/short-read-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Agent Smith devs | Pending | ||
Review via email: mp+33473@code.staging.launchpad.net |
Description of the change
From commit:
1) when processing spool event, there was a potential access past end of buffer
2) also, if a 2nd read() succeeds when processing an spool event, 'i' was not reset so the buffer was accessed at the wrong location
This corrects the current behavior, although I'm not sure the current behavior is entirely accurate. Is it possible to get short read()s where a single event could span multiple read() calls? If so, we'll need to keep some state between calls to spool_process_
To post a comment you must log in.
I'm happy with more anal error handling and have merged this branch now.
However, the way I read the kernel code, a single event cannot span multiple reads:
* If the size of the buffer passed to read isn't large enough to hold the event, read returns -1 and sets errno to EAGAIN.
* If copying the data to userspace fails for some reason, read returns -1 and sets errno to EFAULT.