mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-21 14:00:51 +03:00
src: replace sprintf() with snprintf()
Ref: https://github.com/libssh2/libssh2/pull/235
This commit is contained in:
@@ -297,7 +297,8 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx)
|
||||
return _libssh2_error(agent->session, LIBSSH2_ERROR_AGENT_PROTOCOL,
|
||||
"found no pageant");
|
||||
|
||||
sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
|
||||
snprintf(mapname, sizeof(mapname),
|
||||
"PageantRequest%08x%c", (unsigned)GetCurrentThreadId(), '\0');
|
||||
filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
|
||||
0, PAGEANT_MAX_MSGLEN, mapname);
|
||||
|
||||
|
||||
@@ -1162,7 +1162,7 @@ channel_x11_req(LIBSSH2_CHANNEL *channel, int single_connection,
|
||||
|
||||
_libssh2_random(buffer, LIBSSH2_X11_RANDOM_COOKIE_LEN / 2);
|
||||
for(i = 0; i < (LIBSSH2_X11_RANDOM_COOKIE_LEN / 2); i++) {
|
||||
sprintf((char *)&s[i*2], "%02X", buffer[i]);
|
||||
snprintf((char *)&s[i*2], 3, "%02X%c", buffer[i], '\0');
|
||||
}
|
||||
}
|
||||
s += cookie_len;
|
||||
|
||||
Reference in New Issue
Block a user