Change hard coded length to sizeof