Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • -1 You can't make such assumptions in correct code. Commented Dec 9, 2011 at 17:10
  • 4
    @JamesKanze, I was implying this as a responsibility of the OP. Commented Dec 9, 2011 at 17:12
  • 3
    @JamesKanze: Yes you can. Since the caller was the one who passed in both the pointer and the string, it is certainly his responsibility to make sure the length of the string does not exceed the size of the buffer. Commented Dec 9, 2011 at 17:17
  • @BenjaminLindley In which case, there's no point in having the function, since the caller has to do more work than is done in the function. Commented Dec 9, 2011 at 17:27