Add interface bounds checks in darwin and windows endpoint functions

A broken device with invalid interface numbering could cause
an out-of-bounds array access.

Fixes #1039
Closes #1093
3 files changed