[stem/master] Accounting for NULL access by ctypes

commit 08529723708ed514f6f5e2489d3c1be8c0e9ae36 Author: Damian Johnson <atagar@torproject.org> Date: Sun Feb 17 18:09:58 2013 -0800 Accounting for NULL access by ctypes Evidently accessing argc can raise a ValueError... https://trac.torproject.org/8266 --- stem/util/system.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/stem/util/system.py b/stem/util/system.py index c35e22f..46aead2 100644 --- a/stem/util/system.py +++ b/stem/util/system.py @@ -722,7 +722,15 @@ def get_process_name(): args, argc = [], argc_t() for i in xrange(100): - if argc[i] is None: + # The ending index can be either None or raise a ValueError when + # accessed... + # + # ValueError: NULL pointer access + + try: + if argc[i] is None: + break + except ValueError: break args.append(str(argc[i]))
participants (1)
-
atagar@torproject.org