Skip to content

Commit

Permalink
Merge pull request #184 from Patater/namespace-bytes-copied
Browse files Browse the repository at this point in the history
Return the proper number of bytes copied when reading box namespaces
  • Loading branch information
AlessandroA committed Mar 7, 2016
2 parents 6e354f1 + 57de15f commit f344277
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/system/src/mpu/vmpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,18 @@ static int copy_box_namespace(const char *src, char *dst)

if (src[bytes_copied] == '\0') {
/* We've reached the end of the box namespace. */
break;
++bytes_copied; /* Include the terminating-null in bytes_copied. */
goto done;
}
}

/* We did not find a terminating null in the src. The src has been verified
* in vmpu_box_namespace_from_id as being in the box config table. It is a
* programmer error if the namespace in the box config table is not
* null-terminated, so we halt. */
HALT_ERROR(SANITY_CHECK_FAILED, "vmpu: Box namespace missing terminating-null\r\n");

done:
return bytes_copied;
}

Expand Down

0 comments on commit f344277

Please sign in to comment.