permissioncheck: end modestr with a \0. This prevents a gcc o3 optimization error.