Skip to content

Commit

Permalink
Fix for static analysis issues
Browse files Browse the repository at this point in the history
Below are the issues fixed:
- Buffer not null terminated
- Resource leak

Tracked-On: OAM-122340
Signed-off-by: Sapna <[email protected]>
  • Loading branch information
Sapna1-singh committed Jul 22, 2024
1 parent 26942cf commit f8898d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ static inline int sync_merge(const char *name, int fd1, int fd2)
data.fd2 = fd2;
strncpy(data.name, name, sizeof(data.name));

if (sizeof(data.name) < strlen(name))
data.name[sizeof(data.name) - 1] = '\0';
else
data.name[strlen(name)] = '\0';

do {
ret = ioctl(fd1, SYNC_IOC_MERGE, &data);
} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
Expand Down
1 change: 1 addition & 0 deletions xf86drmSL.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ drm_public int drmSLInsert(void *l, unsigned long key, void *value)
}

++list->count;
free(entry);
return 0; /* Added to table */
}

Expand Down

0 comments on commit f8898d2

Please sign in to comment.