On 06/26/2012 05:31 PM, Zbigniew Jędrzejewski-Szmek wrote:
> PyObject *item = PyTuple_GetItem(args, i);
> char * stritem = PyString_AsString(item);
> iov[i].iov_base = stritem;
> iov[i].iov_len = strlen(stritem);
> 
> I think that there's a problem here -- PyString_AsString will return
> NULL if item is not a string. Also, using PyString_AsStringAndSize would
> avoid the need to iterate over the memory with strlen.
> 
> So maybe something like:
> 
> if(PyString_AsStringAndSize(item, &iov[i].iov_base, &iov[i].iov_len))
>   return NULL;
Ooops. This would lose iov of course.

Zbyszek

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to