Protect strtoul call from undefined behaviour

Change-Id: I75d0ee61b0fe49e381f3b263d519709ba3c476f9