Github user breed commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/586#discussion_r212781950
  
    --- Diff: src/contrib/zkpython/src/c/zookeeper.c ---
    @@ -387,8 +387,8 @@ int parse_acls(struct ACL_vector *acls, PyObject 
*pyacls)
         PyObject *perms = PyDict_GetItemString( a, "perms" );
     #if PY_MAJOR_VERSION >= 3
         acls->data[i].perms = (int32_t)(PyLong_AsLong(perms));
    -    acls->data[i].id.id = strdup( PyUnicode_AsUnicode( 
PyDict_GetItemString( a, "id" ) ) );
    -    acls->data[i].id.scheme = strdup( PyUnicode_AsUnicode( 
PyDict_GetItemString( a, "scheme" ) ) );
    +    acls->data[i].id.id = strdup( PyBytes_AS_STRING( 
PyUnicode_AsASCIIString( PyDict_GetItemString( a, "id" ) ) ) );
    --- End diff --
    
    i think we can have id be "أليس" and i believe it will get messed up by 
this code. we need to use UTF-8 encoding. (unfortunately, i'm not familiar 
enough with python C-bindings to know how to do it correctly...


---

Reply via email to