os: fix unlikely buffer overflow in os.type()

* Fix a buffer overflow that happens iff strlen(info.sysname) > 255.
* Check the return value of uname().
os: handle 256 character hostnames

Fix a (rather academic) buffer overflow. MAXHOSTNAMELEN is 256 on most
platforms, which means the buffer wasn't big enough to hold the
trailing nul byte on a system with a maximum length hostname.