Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Isn using some of the string library extensions such as strlcat and snprintf sufficient to overcome the main safety problems of char * buffer usage so as to make Bstrlib unnecessary?

0
Posted

Isn using some of the string library extensions such as strlcat and snprintf sufficient to overcome the main safety problems of char * buffer usage so as to make Bstrlib unnecessary?

0

A. No. String manipulation, by its very nature requires memory management to go hand in hand with each operation. These solutions do not provide any such thing and continue to defer the problem to the programmer. Arbitrary preconceived length cut-offs are just not adequate. It leads to the typical double problem of “make the buffer large enough for all reasonable cases” that just wastes memory in the most typical cases, while not functioning ideally at all in uncommon cases. Buffer overflows only represent the very worst problem with string support in the C/C++ languages. The other safety features in Bstrlib still give it a notable advantage versus any typical function augmentation based on the C library as a foundation. A survey of other modern programming languages also shows that a larger complement of string manipulation functions are required. Something that the C library or STL or its extensions does not provide.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123