CID
1058392: Out-of-bounds access (OVERRUN_DYNAMIC) [select issue]
CID
1058391 (#1 of 1): Out-of-bounds access (OVERRUN)
32. alloc_strlen: Allocating insufficient memory for the terminating null of the string.
CID
1058390 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)
13. check_return: Calling function "this->class_handler->open_all_classes()" without checking return value. It wraps a library function that may fail and return an error code. [show details]
14. unchecked_value: No check of the return value of "this->class_handler->open_all_classes()".
Signed-off-by: Sage Weil <sage@inktank.com>
if (strlen(pde->d_name) > sizeof(CLS_PREFIX) - 1 + sizeof(CLS_SUFFIX) - 1 &&
strncmp(pde->d_name, CLS_PREFIX, sizeof(CLS_PREFIX) - 1) == 0 &&
strcmp(pde->d_name + strlen(pde->d_name) - (sizeof(CLS_SUFFIX) - 1), CLS_SUFFIX) == 0) {
- char cname[strlen(pde->d_name)];
+ char cname[PATH_MAX + 1];
strcpy(cname, pde->d_name + sizeof(CLS_PREFIX) - 1);
cname[strlen(cname) - (sizeof(CLS_SUFFIX) - 1)] = '\0';
dout(10) << __func__ << " found " << cname << dendl;
class_handler = new ClassHandler();
cls_initialize(class_handler);
- if (g_conf->osd_open_classes_on_start)
- class_handler->open_all_classes();
+ if (g_conf->osd_open_classes_on_start) {
+ int r = class_handler->open_all_classes();
+ if (r)
+ dout(1) << "warning: got an error loading one or more classes: " << cpp_strerror(r) << dendl;
+ }
// load up "current" osdmap
assert_warn(!osdmap);