maskit opened a new issue, #10204:
URL: https://github.com/apache/trafficserver/issues/10204
```
101int
102get_redis_auth_key(char *retKeyBuff, int buffSize)
103{
104 int retval = 0;
105 // Get the Key
1. Condition ssl_param.redis_auth_key_file.length(), taking true branch.
106 if (ssl_param.redis_auth_key_file.length()) {
2. open_fn: Returning handle opened by open.
3. var_assign: Assigning: fd = handle returned from
open(ssl_param.redis_auth_key_file.c_str(), 0).
107 int fd = open(ssl_param.redis_auth_key_file.c_str(), O_RDONLY);
108 struct stat info;
CID 1508975: Argument cannot be negative (NEGATIVE_RETURNS)
[[select
issue](https://scan6.scan.coverity.com/defectInstanceId=34625550&fileInstanceId=157339969&mergedDefectId=1508975)]
4. noescape: Resource fd is not freed or pointed-to in fstat. [Note:
The source code implementation of the function has been overridden by a builtin
model.]
5. Condition 0 == fstat(fd, &info), taking true branch.
109 if (0 == fstat(fd, &info)) {
110 size_t n = info.st_size;
111 std::string key_data;
112 key_data.resize(n);
6. noescape: Resource fd is not freed or pointed-to in read.
113 auto read_len = read(fd, const_cast<char *>(key_data.data()), n);
114 // Strip any trailing newlines
7. Condition read_len > 1, taking true branch.
8. Condition key_data[read_len - 1] == '\n', taking true branch.
10. Condition read_len > 1, taking true branch.
11. Condition key_data[read_len - 1] == '\n', taking true branch.
13. Condition read_len > 1, taking true branch.
14. Condition key_data[read_len - 1] == '\n', taking false branch.
115 while (read_len > 1 && key_data[read_len - 1] == '\n') {
116 --read_len;
9. Jumping back to the beginning of the loop.
12. Jumping back to the beginning of the loop.
117 }
118 memset(retKeyBuff, 0, buffSize);
CID 1508982: Argument cannot be negative (NEGATIVE_RETURNS)
[[select
issue](https://scan6.scan.coverity.com/defectInstanceId=34625480&fileInstanceId=157339969&mergedDefectId=1508982)]
CID 1508997: Out-of-bounds access (OVERRUN) [[select
issue](https://scan6.scan.coverity.com/defectInstanceId=34625595&fileInstanceId=157339969&mergedDefectId=1508997)]
119 strncpy(retKeyBuff, key_data.c_str(), read_len);
120 retval = key_data.length();
121 }
CID 1508977 (#1-2 of 2): Resource leak (RESOURCE_LEAK)
15. leaked_handle: Handle variable fd going out of scope leaks the handle.
122 } else {
123 TSError("Can not get redis auth key.");
124 }
125
126 return retval;
127}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]