From: Krzysztof Opasiak
> Path and name length should not be placed in constant
> size buffer but in allocated memory.
> 
> Use also PATH_MAX macro from limits.h instead of internal
> library macro.

There might be some sense in keeping USBG_MAX_PATH_LENGTH
but defaulting to PATH_MAX.

...
> -     char cpath[USBG_MAX_PATH_LENGTH];
> +     char cpath[PATH_MAX];
> 
> -     sprintf(cpath, "%s/%s/%s", path, g->name, CONFIGS_DIR);
> +     n = snprintf(cpath, PATH_MAX, "%s/%s/%s", path, g->name, CONFIGS_DIR);

Use 'sizeof (path)' then it doesn't matter which literal is used
when the array is allocated.

        David


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to