Skip to content

Commit

Permalink
fix a runtime error for alignment
Browse files Browse the repository at this point in the history
*** TESTING C   bb_nonblocking for when requests are > buffer size ------
src/drivers/ncbbio/ncbbio_log.c:260:62:
runtime error: store to misaligned address 0x5588acc4d982 for type 'int',
which requires 4 byte alignment
  • Loading branch information
wkliao committed Dec 6, 2023
1 parent 07ff7b1 commit 8273a15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/drivers/ncbbio/ncbbio_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ int ncbbio_log_create(NC_bb* ncbbp,
headerp->entry_begin = ncbbp->metadata.nused;
headerp->basenamelen = strlen(basename);

/* Process anme */
*(int*)((char*)headerp->basename + headerp->basenamelen + 1) = procname_len;
/* Process name */
memcpy((char*)headerp->basename + headerp->basenamelen + 1,
&procname_len, sizeof(int));
strncpy((char*)headerp->basename + headerp->basenamelen + 5,
procname, procname_len + 1);

Expand Down

0 comments on commit 8273a15

Please sign in to comment.