Fixed some invalid read errors due to reading 1 byte past the end of a buffer, and the other was accessing an element 1 past the end of an array.
Fixed some invalid read errors due to reading 1 byte past the end of a buffer, and the other was accessing an element 1 past the end of an array.

DenverM80/ds3_c_sdk,chanchett/ds3_c_sdk,SpectraLogic/ds3_c_sdk,robertgrimm/ds3_c_sdk,TigerTechnology/ds3_c_sdk,DenverM80/ds3_c_sdk,rpmoore/ds3_c_sdk,shabtaisharon/ds3_c_sdk,chanchett/ds3_c_sdk,TigerTechnology/ds3_c_sdk,rpmoore/ds3_c_sdk,tigertechdev/ds3_c_sdk,SpectraLogic/ds3_c_sdk,SpectraLogic/ds3_c_sdk,tigertechdev/ds3_c_sdk,TigerTechnology/ds3_c_sdk,TigerTechnology/ds3_c_sdk,rpmoore/ds3_c_sdk,robertgrimm/ds3_c_sdk,tigertechdev/ds3_c_sdk,robertgrimm/ds3_c_sdk,DenverM80/ds3_c_sdk,DenverM80/ds3_c_sdk,shabtaisharon/ds3_c_sdk,robertgrimm/ds3_c_sdk,SpectraLogic/ds3_c_sdk,chanchett/ds3_c_sdk,shabtaisharon/ds3_c_sdk