summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 50aa4bd)
raw | patch | inline | side by side (parent: 50aa4bd)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 17 Jul 2009 12:41:12 +0000 (14:41 +0200) | ||
committer | Florian Forster <sifnfors@stud.informatik.uni-erlangen.de> | |
Fri, 17 Jul 2009 12:48:16 +0000 (14:48 +0200) |
Libraries should not segfault - ever - no matter what a user is doing and how
stupid that might be.
stupid that might be.
src/liboping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index 36a3a3ef623d00c68f68d6fe1bdc241c89d5890e..dc2b4494ee61cfce3e5af4c3e6b3a0c29a5aca0d 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
*/
const char *ping_get_error (pingobj_t *obj)
{
+ if (obj == NULL)
+ return (NULL);
return (obj->errmsg);
}
pinghost_t *current;
pinghost_t *next;
+ if (obj == NULL)
+ return;
+
current = obj->head;
next = NULL;
{
int ret = 0;
- if (value == NULL)
+ if ((obj == NULL) || (value == NULL))
return (-1);
switch (option)
{
int ret;
+ if (obj == NULL)
+ return (-1);
+
if (ping_send_all (obj) < 0)
return (-1);
struct addrinfo *ai_list, *ai_ptr;
int ai_return;
+ if ((obj == NULL) || (host == NULL))
+ return (-1);
+
dprintf ("host = %s\n", host);
if (ping_host_search (obj->head, host) != NULL)
{
pinghost_t *pre, *cur;
+ if ((obj == NULL) || (host == NULL))
+ return (-1);
+
pre = NULL;
cur = obj->head;
pingobj_iter_t *ping_iterator_get (pingobj_t *obj)
{
+ if (obj == NULL)
+ return (NULL);
return ((pingobj_iter_t *) obj->head);
}
pingobj_iter_t *ping_iterator_next (pingobj_iter_t *iter)
{
+ if (iter == NULL)
+ return (NULL);
return ((pingobj_iter_t *) iter->next);
}
size_t orig_buffer_len = *buffer_len;
+ if ((iter == NULL) || (buffer == NULL) || (buffer_len == NULL))
+ return (-1);
+
switch (info)
{
case PING_INFO_USERNAME:
void *ping_iterator_get_context (pingobj_iter_t *iter)
{
+ if (iter == NULL)
+ return (NULL);
return (iter->context);
}
void ping_iterator_set_context (pingobj_iter_t *iter, void *context)
{
+ if (iter == NULL)
+ return;
iter->context = context;
}