Skip to content

Commit

Permalink
Merge pull request #1358 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
osal Integration candidate: Caelum-rc4+dev37
  • Loading branch information
dzbaker authored Jan 26, 2023
2 parents a9fece5 + dff5e0f commit 6fae788
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Development Build: v6.0.0-rc4+dev184
- separate append on volume_name to system_mountpt
- See <https://github.com/nasa/osal/pull/1355>

## Development Build: v6.0.0-rc4+dev179
- Remove obsolete _USING_RTEMS_INCLUDES_
- Support adding default flags at task creation
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 179
#define OS_BUILD_NUMBER 183
#define OS_BUILD_BASELINE "v6.0.0-rc4"

/*
Expand Down
22 changes: 21 additions & 1 deletion src/os/posix/src/os-impl-filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "os-posix.h"
#include "os-shared-filesys.h"
#include "os-shared-idmap.h"
#include "os-shared-common.h"

/****************************************************************************************
DEFINES
Expand Down Expand Up @@ -84,6 +85,8 @@ int32 OS_FileSysStartVolume_Impl(const OS_object_token_t *token)
OS_filesys_internal_record_t *local;
struct stat stat_buf;
const char * tmpdir;
size_t mplen;
size_t vollen;
uint32 i;
enum
{
Expand Down Expand Up @@ -168,7 +171,24 @@ int32 OS_FileSysStartVolume_Impl(const OS_object_token_t *token)
return OS_FS_ERR_DRIVE_NOT_CREATED;
}

snprintf(local->system_mountpt, sizeof(local->system_mountpt), "%s/osal:%s", tmpdir, local->volume_name);
/*
* Note - performing the concatenation in a single snprintf() call seems
* to trigger a (false) pointer overlap warning, because volume_name should
* always be null terminated. To get around this, calculate the
* string size and check that it is within the expected size, and do the
* append of volume_name explicitly.
*/
mplen = snprintf(local->system_mountpt, sizeof(local->system_mountpt), "%s/osal:", tmpdir);
if (mplen < sizeof(local->system_mountpt))
{
vollen = OS_strnlen(local->volume_name, sizeof(local->volume_name));
if ((vollen + mplen) >= sizeof(local->system_mountpt))
{
vollen = sizeof(local->system_mountpt) - mplen - 1;
}
memcpy(&local->system_mountpt[mplen], local->volume_name, vollen);
local->system_mountpt[mplen + vollen] = 0;
}
}

return OS_SUCCESS;
Expand Down

0 comments on commit 6fae788

Please sign in to comment.