From: Florian Forster Date: Sat, 26 Jan 2008 12:59:23 +0000 (+0100) Subject: Merge branch 'liboping-0.3' X-Git-Tag: Net-Oping-1.00~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=684d3fd2cf4f025a4661405f2fc4aa5b57310824;p=liboping.git Merge branch 'liboping-0.3' --- 684d3fd2cf4f025a4661405f2fc4aa5b57310824 diff --cc src/liboping.c index 9d14826,4c614f7..17071fd --- a/src/liboping.c +++ b/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'