[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
compilation issue found in libssh-0.7.6 on VS2017
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: compilation issue found in libssh-0.7.6 on VS2017
- From: Nitesh Srivastava <nitesh.srivastava@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 6 Mar 2019 07:07:02 +0000
- To: "libssh@xxxxxxxxxx" <libssh@xxxxxxxxxx>
Hi ,
Please suggest :
Found compilation (Linker) issue during building libssh 0.7.6 on windows (Visual Studio 2017).Below is the details:
/**
* @internal
*
* @brief Convert a buffer into an unpadded base64 string.
* The caller has to free the memory.
*
* @param hash What should be converted to a base64 string.
*
* @param len Length of the buffer to convert.
*
* @return The base64 string or NULL on error.
*
* @see ssh_string_free_char()
*/
static char *ssh_get_b64_unpadded(const unsigned char *hash, size_t len)
{
char *b64_padded = NULL;
char *b64_unpadded = NULL;
size_t k;
b64_padded = (char *)bin_to_base64(hash, (int)len);
if (b64_padded == NULL) {
return NULL;
}
for (k = strlen(b64_padded); k != 0 && b64_padded[k-1] == '='; k--);
// To:Do replaces strndup() with strcpy_s() as the function is depricated in string.h
// b64_unpadded = strndup(b64_padded, k);
// Correction Done:
b64_unpadded = (char*)malloc(strlen(b64_padded));
memchr(b64_unpadded, 0, sizeof(b64_unpadded));
strcpy_s(b64_unpadded, k, b64_padded);
SAFE_FREE(b64_padded);
return b64_unpadded;
}
Please suggest.
Regards,
Nitesh
[ABB_Logo_Screen_RGB_25px_@xxxxxx]
-
Nitesh Srivastava
Network Control Solutions
ABB Ability & Innovation Centre
3rd Floor, Bhoruka Tech Park
Mahadevpura Main Road,
560048, Bengaluru (India)
Mobile: +91 9379416369
abb.com
| Re: compilation issue found in libssh-0.7.6 on VS2017 | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
