Comments (16)
this implementation also seems off and risky, since the last argument is actually count that could be used as s1[count]
from mlib.
Maybe something like that would do?
from mlib.
Another problem is that strcpy_s guarantees null-termination, but your bound strings may be non-null terminated.
from mlib.
Hmm, you are using strlen in you bounded string size method. That is strange and contradicts with my statement above. Now I see you have max_size + 1 as an array. But you still have to refactor the usage of strncpy
from mlib.
You can even end up with an invalid state since currently:
from mlib.
You could just
or maybe rewrite the m_core_strncpy to M_core_strncpy_s and use it everywhere afterwards.
from mlib.
this method is also implemented incorrectly. the size of the destination buffer can't be removed that simply and the m_core_strncat is also wrong in case of using strncat_s, semantically wrong.
from mlib.
An interesting thing. At least in debug build. The strncpy_s actually may write data past zero terminator, so it mast be saved manually and restored (for OOR compatibility.
from mlib.
The issue with strncpy_s and strncat_s should be fixed in master.
This is strange however. All the tests already passed with Visual, and they did trigger this behavior of truncation...
So I don't know why they succeed...
this method is also implemented incorrectly. the size of the destination buffer can't be removed that simply
Which method?
from mlib.
This is strange however. All the tests already passed with Visual, and they did trigger this behavior of truncation...
So I don't know why they succeed...
It is because there was a constraint violation (as you notice), the default runtime handler is called which terminates the program and returns a negative error code to the caller! This is not handled by the script which assumes a successful termination. (It is fixed in master).
from mlib.
Which method?
bounded string's equal str p
from mlib.
Are you sure about your re-implementation? I've coped with the issue with _s variants. Seems like it is not that bad of an idea to use the secure methods on the bounded strings, since their size is statically defined.
from mlib.
Which method?
bounded string's equal str p
I see no issue with _equal_str_p of bounded string.
Are you sure about your re-implementation?
As sure as the tests passed
from mlib.
I see no issue with _equal_str_p of bounded string.
In case you've also reimplemented the cat method yourself, there might be no issue. But there WAS one.
As sure as the tests passed
I've implemented _s variants through non-_s like so and all tests have also passed ;)
from mlib.
In case you've also reimplemented the cat method yourself, there might be no issue. But there WAS one.
Yes, the service that used the cat method was wrong. But _equal_str_p doesn't use this cat method :)
from mlib.
Maybe I've misrememeber =)
Ok, closing the issue.
from mlib.
Related Issues (20)
- Compiler errors HOT 3
- README example not work HOT 3
- Add EMPLACE_TYPE support for B+TREE, DICT, RB-TREE, BUFFER, CONCURRENT HOT 3
- bitset: function for getting minimum index with bit set HOT 3
- Memory leak HOT 5
- Proper way to share generated container accross multiple .c files HOT 15
- Overflow issue in bit set HOT 1
- Naming Critique HOT 20
- _previous in m-rbtree.h is actually next HOT 2
- Possible issue in m-core.h HOT 2
- Possible assertion error HOT 6
- M_EMPTY_P(max) doesn't work HOT 4
- BPTREEI_OPLIST2_P4 missing push definition?
- Is it actually possible to create a fixed-size looping buffer? HOT 10
- BUFFER_DEF / BUFFER_THREAD_UNSAFE: performance issue HOT 1
- RB-tree _it_from on root node HOT 1
- Memory issue with _pop_at function while using 2d arrays HOT 1
- string_t: extremely confusing methods names: string_clean and string_clear HOT 5
- Change _str suffix HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlib.