Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct server_id {
- uint32_t pid;
- uint32_t vnn;
- uint64_t unique_id;
- }
- struct server_id interpret_pid(const char *pid_string)
- {
- struct server_id result;
- ....
- /* Assigning to result.pid may have overflowed
- Map negative pid to -1: i.e. error */
- if (result.pid < 0) {
- result.pid = -1;
- }
- ....
- }
- This suspicious code was found in samba project by PVS-Studio static code analyzer.
- Warning message is:
- V547 Expression 'result.pid < 0' is always false. Unsigned type value is never < 0. util.c 2376
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment