Commit Graph

30 Commits

Author SHA1 Message Date
Dmitry Podgorny
c319ee6583 handler: fix memory leak and use-after-free errors
The errors are related to newly added handler_system_delete_all().
2017-07-01 16:24:30 +03:00
Dmitry Podgorny
cc297eff45 handler: shut compiler up
Fixes the next warning:
    src/handler.c:683:25: error: ‘key2’ may be used uninitialized in
    this function [-Werror=uninitialized]

In fact key2 initialised and used under the same condition.
2017-06-29 20:43:03 +03:00
Dmitry Podgorny
e151096834 handler: don't call time_stamp() twice in handler_fire_timed() 2017-06-29 20:22:55 +03:00
Dmitry Podgorny
a845c7ec3d hash: avoid allocation when replace value in hash_add()
Memory allocation may fail. We don't need to allocate new entry when we
already have one.
2017-06-29 20:22:55 +03:00
Dmitry Podgorny
5ecb0c5d0c conn: clear system handlers on reconnect
xmpp_conn_t object can be reused with saving user's handlers.
However, saving system handlers can lead to a fail during connection
process. This is because old object may contain timed handlers for
missed features or other handlers that would handle incoming stanzas
incorrectly.
2017-06-29 20:22:55 +03:00
Steffen Jaeckel
49e7572059 fix function-pointer storage
the C standard says that you're not allowed to cast a function pointer to
something else

 6.3.2.3 §8:

A pointer to a function of one type may be converted to a pointer
to a function of another type and back again
2017-06-29 16:58:11 +02:00
Dmitry Podgorny
ba40bf1040 handler: fix possible corruption of handler lists
User's handler may delete other handlers. If deleted handler is the next
or the previous to the running one it leads to a list corruption.
Don't cache previous/next items when we walk through a handler's list.
2017-06-23 21:47:10 +03:00
Dmitry Podgorny
9a5fe8b96d handler: allow to add same handler callback with different userdata
According to #97. A single callback can distinguish different cases
using the userdata. Current implementation doesn't allow to delete a
particular couple (handler, userdata), but rather deletes all handlers
regardless of the userdata.
2017-03-24 22:38:16 +02:00
Dmitry Podgorny
80a7ea0b7c Fix spacing in handler.c 2016-12-02 16:56:45 +02:00
Dmitry Podgorny
a3da77b8f6 stanza: return const char* for non allocated strings
If interface function returns char* the result must be freed with
xmpp_free().

In case of const char* the result must not be changed by user. Also, the
result is valid only during stanza lifetime.
2016-04-27 11:56:50 +00:00
Dariusz Dwornikowski
71f75b2e2e Closes #31 2014-10-23 08:44:52 +02:00
Vitaly Takmazov
58613ea7f3 fix MSVC build 2014-09-08 13:41:30 +03:00
Jack Moffitt
13175787fc Document handler return values. 2012-02-07 22:49:56 -07:00
Jack Moffitt
370a371800 Dual licensed libstrophe under MIT and GPLv3.
Updated copyright headers.
2009-06-15 15:26:10 -06:00
Jack Moffitt
2eb9847ba8 Fixed memory leak in one off handlers. 2009-04-14 15:53:04 -06:00
Jack Moffitt
20bac5b4de Fixed small memory leak in id handler logic. 2009-04-14 14:22:34 -06:00
Jack Moffitt
6560ef253f Small patch to handler_fire_stanza() from Matthew Wild <mwild1@gmail.com>. prev was not advanced along with item. 2008-08-26 04:47:36 +00:00
Jack Moffitt
1c0bbb1f5d Reverting r513. I mistakenly committed my entire tree. 2008-08-26 04:46:41 +00:00
Jack Moffitt
ade38ae188 Small patch to handler_fire_stanza() from Matthew Wild <mwild1@gmail.com>. prev was not advanced along with item. 2008-08-26 04:44:19 +00:00
Jack Moffitt
3b47afaac9 Fix warnings and line endings from previous SRV commit. Get rid of domain parameter of xmpp_connect_client(). Remove usused handler.c helper left over from previous commit. 2008-07-03 05:20:59 +00:00
Jack Moffitt
9454c8f29a Replace last patch with new patch that does same thing better. This new method adds xmpp_stanza_get_child_by_ns() to the API. Implementation and copyright assigned to us by Matthew Wild <mwild1@gmail.com>. 2008-07-03 02:46:24 +00:00
Jack Moffitt
31843a423b Implement namespace matching for immediate children. This makes the C library consistent with the JavaScript one. 2008-07-03 02:26:27 +00:00
Jack Moffitt
9c49b16554 Fix examples to use new API and lots of compiler warnings. 2008-07-02 23:17:27 +00:00
Jack Moffitt
65a174ee7e Most public API points are now documented. 2008-06-24 14:43:54 +00:00
Jack Moffitt
b6027cfd7f Updated copyright years and fixed LLC typo. 2008-06-19 22:33:13 +00:00
James Canete
6180bbcc0a Changed id handlers so they are removed if they do not return true. 2005-11-08 05:03:18 +00:00
Ralph Giles
76e0c6a4b3 Add the 'libstrophe' name to the copyright headers. 2005-06-15 16:58:11 +00:00
Jack Moffitt
e6fa890d3d Minor fixes for Win32 build. It now builds, but doesn't link. 2005-06-14 22:35:15 +00:00
Ralph Giles
72699eff45 Rename xmpp.h to strophe.h and apply the name changes to the internal
header multiple include protection.
2005-06-14 14:25:42 +00:00
Ralph Giles
f27235b862 Move the xmpp library to its new name. 2005-06-14 14:10:31 +00:00