From 207e0a6eee67cb7f3bde582c4f68ee3285f2f5ba Mon Sep 17 00:00:00 2001 From: Brandon Schneider Date: Mon, 13 May 2019 16:12:03 -0500 Subject: [PATCH] Do not test len of None (#923) NAS-101531 Signed-off-by: Brandon Schneider --- iocage_lib/ioc_fstab.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/iocage_lib/ioc_fstab.py b/iocage_lib/ioc_fstab.py index 22c8c2b10..0be050887 100644 --- a/iocage_lib/ioc_fstab.py +++ b/iocage_lib/ioc_fstab.py @@ -463,6 +463,9 @@ def __fstab_encode__(self, _string): Example: ' ' -> \040 """ + if _string is None: + return _string + result = ctypes.create_string_buffer(len(_string) * 4 + 1) self.libc.strvis( result, _string.encode(), 0x4 | 0x8 | 0x10 | 0x2000 | 0x8000 @@ -476,6 +479,9 @@ def __fstab_decode__(self, _string): Example: \040 -> ' ' """ + if _string is None: + return _string + result = ctypes.create_string_buffer(len(_string) * 4 + 1) self.libc.strunvis( result, _string.encode(), 0x4 | 0x8 | 0x10 | 0x2000 | 0x8000