File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import cython
22
33from libc.stdlib cimport malloc
4+ from libc.string cimport strlen
45
56
67cdef extern from " crypt_wrapper.h" :
78 void _encrypt_into(const char * unencrypted, char * encrypted)
89 void _decrypt_into(const char * encrypted, char * unencrypted)
910
1011cdef char * _decrypt(const char * encrypted):
11- cdef char * unencrypted = < char * > malloc(((len (encrypted)) + 1 ) * sizeof(char ))
12+ cdef char * unencrypted = < char * > malloc(((strlen (encrypted)) + 1 ) * sizeof(char ))
1213 if not unencrypted:
1314 return NULL # malloc failed
1415 _decrypt_into(encrypted, unencrypted)
1516 return unencrypted
1617
1718cdef char * _encrypt(const char * unencrypted):
18- cdef char * encrypted = < char * > malloc(((len (unencrypted)) + 1 ) * sizeof(char ))
19+ cdef char * encrypted = < char * > malloc(((strlen (unencrypted)) + 1 ) * sizeof(char ))
1920 if not encrypted:
2021 return NULL # malloc failed
2122 _encrypt_into(unencrypted, encrypted)
You can’t perform that action at this time.
0 commit comments