Skip to content

Commit

Permalink
[LibOS] Fix buffer overflow in proc code
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>
  • Loading branch information
pwmarcz authored and mkow committed Sep 6, 2021
1 parent 8efe371 commit 5b84296
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions LibOS/shim/src/fs/proc/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ int proc_thread_maps_load(struct shim_dentry* dent, char** out_data, size_t* out
char pr = (vma->flags & MAP_PRIVATE) ? 'p' : 's';

#define ADDR_FMT(addr) ((addr) > 0xffffffff ? "%lx" : "%08lx")
#define EMIT(fmt...) \
do { \
offset += snprintf(buffer + offset, buffer_size - offset, fmt); \
#define EMIT(fmt...) \
do { \
if (offset < buffer_size) \
offset += snprintf(buffer + offset, buffer_size - offset, fmt); \
} while (0)

retry_emit_vma:
Expand Down

0 comments on commit 5b84296

Please sign in to comment.