Code

Merge branch 'liboping-0.3'
authorFlorian Forster <octo@verplant.org>
Sat, 26 Jan 2008 12:59:23 +0000 (13:59 +0100)
committerFlorian Forster <octo@verplant.org>
Sat, 26 Jan 2008 12:59:23 +0000 (13:59 +0100)
1  2 
src/liboping.c

diff --cc src/liboping.c
index 9d1482634fa12baf36f5c81c9a518ecdbe6449dd,4c614f744adfa5bfd7a78a4e7573e5db385adabb..17071fd8f50bd66b93f1751a6f6144aa684a27b9
@@@ -1267,21 -1253,9 +1267,21 @@@ int ping_iterator_get_info (pingobj_ite
  
        switch (info)
        {
 +              case PING_INFO_USERNAME:
 +                      ret = ENOMEM;
 +                      *buffer_len = strlen (iter->username);
 +                      if (orig_buffer_len <= *buffer_len)
 +                              break;
 +                      /* Since (orig_buffer_len > *buffer_len) `strncpy'
 +                       * will copy `*buffer_len' and pad the rest of
 +                       * `buffer' with null-bytes */
 +                      strncpy (buffer, iter->username, orig_buffer_len);
 +                      ret = 0;
 +                      break;
 +
                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'