ws: Use right printf format for limiting string length

We should use ```%.*s``` to limit string length to print.