Added NULL and bounds checks to urls.c