Skip to content

Commit

Permalink
Fix Coverity #80907 "Copy into fixed size buffer" in socketoutput.c
Browse files Browse the repository at this point in the history
  • Loading branch information
bostjan committed May 7, 2015
1 parent 850d1ad commit a6a4caa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/output/socketoutput.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ int snoopy_output_socketoutput (char *logMessage, int errorOrMessage)
}

remote.sun_family = AF_LOCAL;
strcpy(remote.sun_path, snoopy_configuration.output_path);
strncpy(remote.sun_path, snoopy_configuration.output_path, 108);
if (strlen(snoopy_configuration.output_path) > 107) {
remote.sun_path[107] = '\0';
}

remoteLength = strlen(remote.sun_path) + sizeof(remote.sun_family);
if (connect(s, (struct sockaddr *)&remote, remoteLength) == -1) {
close(s);
Expand Down

0 comments on commit a6a4caa

Please sign in to comment.