Closed mfrey closed 5 years ago
I think the purpose is get from 127.0.0.1/9000 to "char *udp=127.0.0.1" and "int port=9000".
udp = strtok(udp, "/"); deliveres the first part, while strtok(NULL, "/") deliveres the second part.
Note, that if the first parameter is a null pointer the function continues scanning wehere a previous successful call ended. Therefore, you cannot execute strtok with NULL as first parameter, without the overall context as you did in your example code. This is by design of the stdlib. However, there is a check missing, if udp is NULL, strtok must not be called with NULL as first parameter.
For Reference see: http://www.cplusplus.com/reference/cstring/strtok/
I've missed that. Can you just delete the issue?
we still have the check of udp missing, should we create a new issue for that?
i'm already writing the fix
we still have the check of udp missing, should we create a new issue for that?
I'm already writing the fix. PR will be up in a few minutes
hmmm. I am not authorized to delete an issue.
hmmm. I am not authorized to delete an issue.
Okay. I'm going to add some background on the memory leak and give this issue a proper title.
There is a potential memory leak in
ccn-lite-ctrl.c
identified by scan-build.sh/clang static analyzerEDIT: Originally posting was about strok/strtol. Hence, the first seven replies can be ignored for this issue.