X-Git-Url: http://git.silc.fi/gitweb/?a=blobdiff_plain;f=lib%2Fsilcutil%2Fsilcutil.c;h=870bd60613aed0e67f0143c79d570b97aa93011a;hb=306cc839060cf3f1175ddad4a7da434b6a436d09;hp=75e85f933fbecc049e1251b132f6b338714590d2;hpb=e0fee2ed75e024dc18f60e6404489db3d6eadad4;p=runtime.git diff --git a/lib/silcutil/silcutil.c b/lib/silcutil/silcutil.c index 75e85f93..870bd606 100644 --- a/lib/silcutil/silcutil.c +++ b/lib/silcutil/silcutil.c @@ -20,9 +20,8 @@ * These are general utility functions that doesn't belong to any specific * group of routines. */ -/* $Id$ */ -#include "silc.h" +#include "silcruntime.h" /* Gets line from a buffer. Stops reading when a newline or EOF occurs. This doesn't remove the newline sign from the destination buffer. The @@ -107,8 +106,10 @@ int silc_parse_userfqdn(const char *string, return 0; } - memset(user, 0, user_size); - memset(fqdn, 0, fqdn_size); + if (user) + memset(user, 0, user_size); + if (fqdn) + memset(fqdn, 0, fqdn_size); if (!string) { silc_set_errno(SILC_ERR_INVALID_ARGUMENT); @@ -256,14 +257,14 @@ char *silc_fingerprint(const unsigned char *data, SilcUInt32 data_len) return NULL; for (i = 0; i < data_len; i++) { - silc_snprintf(cp, len, "%02X", data[i]); + silc_snprintf((char *)cp, len, "%02X", data[i]); cp += 2; len -= 2; if ((i + 1) % 2 == 0) - silc_snprintf(cp++, len--, " "); + silc_snprintf((char *)cp++, len--, " "); if ((i + 1) % 10 == 0) - silc_snprintf(cp++, len--, " "); + silc_snprintf((char *)cp++, len--, " "); } i--; if ((i + 1) % 10 == 0) @@ -271,7 +272,7 @@ char *silc_fingerprint(const unsigned char *data, SilcUInt32 data_len) if ((i + 1) % 2 == 0) *(--cp) = '\0'; - return fingerprint; + return (char *)fingerprint; } /* Return TRUE if the `data' is ASCII string. */