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
@@@ -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'