isofs: fixes for coverity defects
.use safe string copy functions .CD-ROM are always mounted read-only
This commit is contained in:
parent
1c480f749a
commit
c21503bdf8
|
@ -13,12 +13,10 @@ int fs_readsuper() {
|
|||
cp_grant_id_t label_gid;
|
||||
size_t label_len;
|
||||
int r = OK;
|
||||
int readonly;
|
||||
|
||||
fs_dev = fs_m_in.REQ_DEV;
|
||||
label_gid = fs_m_in.REQ_GRANT;
|
||||
label_len = fs_m_in.REQ_PATH_LEN;
|
||||
readonly = 1; /* Always mount devices read only. */
|
||||
|
||||
if (label_len > sizeof(fs_dev_label))
|
||||
return(EINVAL);
|
||||
|
@ -33,8 +31,8 @@ int fs_readsuper() {
|
|||
/* Map the driver label for this major */
|
||||
bdev_driver(fs_dev, fs_dev_label);
|
||||
|
||||
/* Open the device the file system lives on */
|
||||
if (bdev_open(fs_dev, readonly ? R_BIT : (R_BIT|W_BIT)) != OK) {
|
||||
/* Open the device the file system lives on in read only mode */
|
||||
if (bdev_open(fs_dev, R_BIT) != OK) {
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ size_t *offsetp;
|
|||
while(cp[0] == '/')
|
||||
cp++;
|
||||
if (cp[0] == '\0') {
|
||||
strcpy(string, ".");
|
||||
strlcpy(string, ".", NAME_MAX + 1);
|
||||
ncp = cp;
|
||||
}
|
||||
else
|
||||
|
@ -360,7 +360,7 @@ char string[NAME_MAX+1]; /* component extracted from 'old_name' */
|
|||
if (len == 0)
|
||||
{
|
||||
/* Return "." */
|
||||
strcpy(string, ".");
|
||||
strlcpy(string, ".", NAME_MAX + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -188,8 +188,10 @@ int fs_getdents(void) {
|
|||
done = TRUE;
|
||||
release_dir_record(dir_tmp);
|
||||
} else { /* The dir record is valid. Copy data... */
|
||||
if (dir_tmp->file_id[0] == 0) strcpy(name,".");
|
||||
else if (dir_tmp->file_id[0] == 1) strcpy(name,"..");
|
||||
if (dir_tmp->file_id[0] == 0)
|
||||
strlcpy(name, ".", NAME_MAX + 1);
|
||||
else if (dir_tmp->file_id[0] == 1)
|
||||
strlcpy(name, "..", NAME_MAX + 1);
|
||||
else {
|
||||
/* Extract the name from the field file_id */
|
||||
strncpy(name, dir_tmp->file_id,
|
||||
|
@ -211,7 +213,7 @@ int fs_getdents(void) {
|
|||
continue;
|
||||
}
|
||||
|
||||
strcpy(name_old,name);
|
||||
strlcpy(name_old, name, NAME_MAX + 1);
|
||||
|
||||
/* Compute the length of the name */
|
||||
cp = memchr(name, '\0', NAME_MAX);
|
||||
|
|
Loading…
Reference in a new issue