Erik Faye-Lund <kusmabite@xxxxxxxxx> writes: > DIR *opendir(const char *name) > { > - int len; > + int len = strlen(name); > DIR *p; > - p = malloc(sizeof(DIR)); > + p = malloc(sizeof(DIR) + len + 2); > if (!p) > return NULL; > > - memset(p, 0, sizeof(DIR)); > - strncpy(p->dd_name, name, PATH_MAX); > - len = strlen(p->dd_name); > + memset(p, 0, sizeof(DIR) + len + 2); > + strcpy(p->dd_name, name); I'd queue this anyway, but I think you do not have to memset() that many bytes. It should be enough to clear sizeof(DIR) here; you have to assign NUL p->dd_name[len+2] though. > p->dd_name[len] = '/'; > p->dd_name[len+1] = '*'; > > -- > 1.7.3.2.493.gc8738 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html