Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
Fixed potential overflow in run_command function
Browse files Browse the repository at this point in the history
If the size returned by uv_fs_event_getpath is 1023, the ++size present in original file version causes a buffer overflow in the path array.
  • Loading branch information
BluByte committed Mar 17, 2015
1 parent 6ae0e43 commit 00210db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/onchange/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void run_command(uv_fs_event_t *handle, const char *filename, int events, int st
size_t size = 1023;
// Does not handle error if path is longer than 1023.
uv_fs_event_getpath(handle, path, &size);
path[++size] = '\0';
path[size] = '\0';

fprintf(stderr, "Change detected in %s: ", path);
if (events & UV_RENAME)
Expand Down

0 comments on commit 00210db

Please sign in to comment.