author | Florian Forster <octo@verplant.org> | |
Sat, 26 Jan 2008 12:59:23 +0000 (13:59 +0100) | ||
committer | Florian Forster <octo@verplant.org> | |
Sat, 26 Jan 2008 12:59:23 +0000 (13:59 +0100) |
1 | 2 | |||
---|---|---|---|---|
src/liboping.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc src/liboping.c
index 9d1482634fa12baf36f5c81c9a518ecdbe6449dd,4c614f744adfa5bfd7a78a4e7573e5db385adabb..17071fd8f50bd66b93f1751a6f6144aa684a27b9
--- 1/src/liboping.c
--- 2/src/liboping.c
+++ b/src/liboping.c
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'