We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4f21d7 commit ef08463Copy full SHA for ef08463
Modules/_ssl/misc.c
@@ -15,7 +15,14 @@ _PySSL_BytesFromBIO(_sslmodulestate *state, BIO *bio)
15
PyErr_SetString(PyExc_ValueError, "Not a memory BIO");
16
return NULL;
17
}
18
- return PyBytes_FromStringAndSize(data, size);
+
19
+ PyBytesWriter *writer = PyBytesWriter_Create(size);
20
+ if (writer == NULL) {
21
+ return NULL;
22
+ }
23
+ char *str = PyBytesWriter_GetData(writer);
24
+ memcpy(str, data, size);
25
+ return PyBytesWriter_Finish(writer);
26
27
28
/* BIO_s_mem() to PyUnicode
0 commit comments