src/liboping.c: Return the number of bytes actually required to store the hostname
authorFlorian Forster <octo@verplant.org>
Sat, 26 Jan 2008 12:58:30 +0000 (13:58 +0100)
committerFlorian Forster <octo@verplant.org>
Sat, 26 Jan 2008 12:58:30 +0000 (13:58 +0100)
Including the terminating NULL-byte.

src/liboping.c

index f749301..62bc461 100644 (file)
@@ -1239,7 +1239,7 @@ int ping_iterator_get_info (pingobj_iter_t *iter, int info,
        {
                case PING_INFO_HOSTNAME:
                        ret = ENOMEM;
-                       *buffer_len = strlen (iter->hostname);
+                       *buffer_len = strlen (iter->hostname) + 1;
                        if (orig_buffer_len <= *buffer_len)
                                break;
                        /* Since (orig_buffer_len > *buffer_len) `strncpy'