Skip to content

Commit

Permalink
Merge pull request #91 from IVOES/fix-unbounded-write
Browse files Browse the repository at this point in the history
Fix unbounded write
  • Loading branch information
gozfree authored May 27, 2023
2 parents a9cbf4a + 78c602a commit 93d04a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gear-lib/libfile/filewatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ int fw_update_watch(struct fw *fw, struct inotify_event *iev)
return -1;
}
memset(full_path, 0, sizeof(full_path));
sprintf(full_path, "%s/%s", path, iev->name);
snprintf(full_path, sizeof(full_path), "%s/%s", path, iev->name);
if (iev->mask & IN_CREATE) {
if (iev->mask & IN_ISDIR) {
fw_add_watch_recursive(fw, full_path);
Expand Down
2 changes: 1 addition & 1 deletion gear-lib/libsock/test_libsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ int main(int argc, char **argv)
while (1) {
memset(buf, 0, sizeof(buf));
printf("input> ");
scanf("%s", buf);
scanf("%63s", buf);
printf("%s:%d fd=%d\n", __func__, __LINE__, sc->fd);
n = sock_send(sc->fd, buf, strlen(buf));
if (n == -1) {
Expand Down

0 comments on commit 93d04a5

Please sign in to comment.