Message22265
Logged In: YES
user_id=775521
Don't apply the patch - it's not tested, but just serves as
an example, and it's certainly not complete.
For some _r functions it's quite obvious how they should be
used. For ones with variable-length buffers accompanying
the struct to be filled in it's not clear how they should be
sized. It's also not clear whether the ERANGE return should
be used to 'automatically' realloc a larger buffer, or
whether the ERANGE error should simply be passed back to
Python as a general failure. For some buffers (asctime_r)
the maximum size can be guessed based on common sense, for
others, defines exist in system headers which may not be
portable, requiring possible further configure checks.
I think the way I would fix this is to introduce a wrapper
for each reentrant function that returns a malloc'ed buffer
that must be freed by the caller when done with the
structure. The wrapper would continually allocate larger
buffers until the size was correct.
Alteratively, one might argue I'm being overly paranoid, and
that for each function we should be able to guess a sensible
buffer length, then just fail if the api call returns too
much data. |
|
Date |
User |
Action |
Args |
2007-08-23 14:25:51 | admin | link | issue1018492 messages |
2007-08-23 14:25:51 | admin | create | |
|