mirror of
https://github.com/sonertari/SSLproxy
synced 2024-11-02 15:40:19 +00:00
Check malloc retval and mark ptr arguments non-null
This commit is contained in:
parent
3579fb6891
commit
2cc353f274
5
sys.c
5
sys.c
@ -217,6 +217,9 @@ sys_proc_info(pid_t pid, char **path, uid_t *uid, gid_t *gid) {
|
||||
|
||||
/* fetch process path */
|
||||
*path = malloc(PROC_PIDPATHINFO_MAXSIZE);
|
||||
if (!*path) {
|
||||
return -1;
|
||||
}
|
||||
int path_len = proc_pidpath(pid, *path, PROC_PIDPATHINFO_MAXSIZE);
|
||||
if (path_len == -1) {
|
||||
free(*path);
|
||||
@ -238,7 +241,7 @@ char *
|
||||
sys_user_str(uid_t uid)
|
||||
{
|
||||
int bufsize;
|
||||
if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1) {
|
||||
if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1) {
|
||||
log_err_printf("failed to get password bufsize: %s\n",
|
||||
strerror(errno));
|
||||
return NULL;
|
||||
|
2
sys.h
2
sys.h
@ -41,7 +41,7 @@ int sys_pidf_open(const char *) NONNULL(1) WUNRES;
|
||||
int sys_pidf_write(int) WUNRES;
|
||||
void sys_pidf_close(int, const char *) NONNULL(2);
|
||||
|
||||
int sys_proc_info(pid_t, char **, uid_t *, gid_t *) WUNRES;
|
||||
int sys_proc_info(pid_t, char **, uid_t *, gid_t *) WUNRES NONNULL(2,3,4);
|
||||
|
||||
char * sys_user_str(uid_t) WUNRES MALLOC;
|
||||
char * sys_group_str(gid_t) WUNRES MALLOC;
|
||||
|
Loading…
Reference in New Issue
Block a user