fix crash/out-of-bound read in sscanf