add checks for invalid buffer pointers and lengths
Replace deprecated M_DONTWAIT with M_NOWAIT.

Reviewed by:	jfv