Revert "- fix coverity issues 966593-966596"

This reverts commit 5d1004f15d13061aae5819a07dab48674b2390d2.
Revert "fix coverity issue 966597 - error line is not always initialised"

This reverts commit 0ef5bef97ce319f065ab70d4426722cd0017c868.
safety check to ensure we dont send out beyond the users buffer