View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001369 | SOGo | SOPE | public | 2011-07-12 15:52 | 2011-07-18 14:18 |
Reporter | buzzdee | Assigned To | francis | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 1.3.7a | ||||
Fixed in Version | 1.3.8a | ||||
Summary | 0001369: crash in the webinterface, just when the webinterface is idle | ||||
Description | The crash happens on OpenBSD i386 using SOPE/SOGo 1.3.7a. It easily materializes, when running sogo in gdb with the following parameters: gdb /usr/local/sbin/sogod It just needs one client connected to the web interface, idling around in a mail folder. When using the watchdog, the bug is not that obvious, since it will restart another instance and its going on... The crasher always produces a backtrace like this:
I examined it more, but I can't scroll back right now, however, the _buffer is 32 bytes long (0..31) but pos is 32, so its trying to access the string past the buffer. I added a check to check whether post < _len in the if statement. | ||||
Additional Information | Please could you review this patch, and if possible add it to 1.3.8? Taking a look at the roadmap overview, it seems 1.3.8 is not far in the future ;) | ||||
Tags | No tags attached. | ||||
2011-07-12 15:52
|
patch-sope-appserver_NGObjWeb_NGHttp_NGUrlFormCoder_m (544 bytes)
$OpenBSD$ hope to fix crasher --- sope-appserver/NGObjWeb/NGHttp/NGUrlFormCoder.m.orig Tue Nov 2 15:12:13 2010 +++ sope-appserver/NGObjWeb/NGHttp/NGUrlFormCoder.m Tue Jul 12 17:35:48 2011 @@ -154,7 +154,7 @@ NGHashMap *NGDecodeUrlFormParameters(const unsigned ch value = len > 0 ? urlStringFromBuffer(buffer, len) : (NSString *)@""; // skip '&' - if (_buffer[pos] == '&' || _buffer[pos] == '?') pos++; + if (pos < _len && _buffer[pos] == '&' || _buffer[pos] == '?') pos++; } if (value == nil) |
I added some NSLogs to the NGDecodeUrlFormParameters function, the output can look like this: 2011-07-17 15:48:35.144 sogod[4217] NGDecodeUrlFormParameters initial: _buffer: sort=date&asc=false&no_headers=1LH When skipping the & and ?, there pos is one larger than the length of the buffer. So when it accesses _buffer[pos], it accesses the byte in memory after the buffer. |
|
2011-07-17 14:13
|
patch-sope-appserver_NGObjWeb_NGHttp_NGUrlFormCoder_m-new (548 bytes)
$OpenBSD$ hope to fix crasher --- sope-appserver/NGObjWeb/NGHttp/NGUrlFormCoder.m.orig Tue Nov 2 15:12:13 2010 +++ sope-appserver/NGObjWeb/NGHttp/NGUrlFormCoder.m Tue Jul 12 17:35:48 2011 @@ -154,7 +154,7 @@ NGHashMap *NGDecodeUrlFormParameters(const unsigned ch value = len > 0 ? urlStringFromBuffer(buffer, len) : (NSString *)@""; // skip '&' - if (_buffer[pos] == '&' || _buffer[pos] == '?') pos++; + if ((pos < _len) && (_buffer[pos] == '&' || _buffer[pos] == '?')) pos++; } if (value == nil) |
Fixed in revision e83ede65860f4b5861aecfd393b724488b35f524. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2011-07-12 15:52 | buzzdee | New Issue | |
2011-07-12 15:52 | buzzdee | File Added: patch-sope-appserver_NGObjWeb_NGHttp_NGUrlFormCoder_m | |
2011-07-17 14:11 | buzzdee | Note Added: 0002716 | |
2011-07-17 14:13 | buzzdee | File Added: patch-sope-appserver_NGObjWeb_NGHttp_NGUrlFormCoder_m-new | |
2011-07-18 14:18 | francis | Note Added: 0002720 | |
2011-07-18 14:18 | francis | Status | new => resolved |
2011-07-18 14:18 | francis | Fixed in Version | => 1.3.8a |
2011-07-18 14:18 | francis | Resolution | open => fixed |
2011-07-18 14:18 | francis | Assigned To | => francis |