Use strdup here, mostly to make coverity shut up.
Coverity cid 45
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
int len, pos;
char *mount_path;
char *src;
- char buf[strlen(orig_str) + 1];
- strcpy(buf, orig_str);
+ char *buf = strdup(orig_str);
mount_path = strrchr(buf, ':');
if (!mount_path) {
printf("source mount path was not specified\n");
+ free(buf);
return NULL;
}
if (mount_path == buf) {
printf("server address expected\n");
+ free(buf);
return NULL;
}
if (!*mount_path) {
printf("incorrect source mount path\n");
+ free(buf);
return NULL;
}
src = resolve_addrs(buf);
+ free(buf);
if (!src)
return NULL;