小编Cho*_*hoi的帖子

memcpy 分段错误。数据结构边界未对齐

我正在尝试调试此错误,但有一段时间无法做到这一点。我尝试使用 memmove 作为替代方案,但这也会导致分段错误。此问题中代码的链接发布在 - http://pastebin.com/hiwV5G04

有人可以帮我理解我做错了什么吗?

//------------------------------------------------------------------------
// Somewhere in the main function, This is the piece of code I am executing
//------------------------------------------------------------------------
SslDecryptSession *ssl_session = malloc(sizeof(struct _SslDecryptSession ));
ssl_session->client_random.data = NULL;  //Make the stuff point somewhere. Else can use malloc also here. Not sure if this is a problem
ssl_session->server_random.data= NULL;
const u_char *payload;                  /* Packet payload */
//Case for client random
printf("Client Random ");
for (cs_id = 11; cs_id < 43; cs_id++){
printf("%hhX", payload[cs_id] );
}
printf("\n");
cs_id=11; …
Run Code Online (Sandbox Code Playgroud)

c debugging gdb memcpy wireshark

5
推荐指数
1
解决办法
2万
查看次数

SSL结构的成员

在 OpenSSL 的 SSL/TLS 客户端实现中SSL定义了一个结构。例如这里通常是前几行(来自链接)。

SSL_CTX* ctx = NULL;
BIO *web = NULL, *out = NULL;
SSL *ssl = NULL;

init_openssl_library();
Run Code Online (Sandbox Code Playgroud)

我一直无法在 OpenSSL 库的头文件中找到它的结构。我怎样才能学习内容SSL * ssl

c ssl openssl

5
推荐指数
1
解决办法
3779
查看次数

标签 统计

c ×2

debugging ×1

gdb ×1

memcpy ×1

openssl ×1

ssl ×1

wireshark ×1