Skip to content

Commit

Permalink
check malloc success
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Mauchle committed Apr 27, 2021
1 parent 1759ed3 commit edd2772
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,14 +841,16 @@ int msmppe(unsigned char *attrs, int length, uint8_t type, char *attrtxt, struct

int rewriteusername(struct request *rq, struct tlv *attr) {
char *orig = (char *)tlv2str(attr);
if (!orig)
return 0;
if (!dorewritemodattr(attr, rq->from->conf->rewriteusername)) {
free(orig);
return 0;
free(orig);
return 0;
}
if (strlen(orig) != attr->l || memcmp(orig, attr->v, attr->l))
rq->origusername = (char *)orig;
rq->origusername = (char *)orig;
else
free(orig);
free(orig);
return 1;
}

Expand Down
1 change: 1 addition & 0 deletions tlscommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ int addmatchcertattr(struct clsrvconf *conf, const char *match) {
}

certattrmatch = malloc(sizeof(struct certattrmatch));
if (!certattrmatch) return 0;
memset(certattrmatch, 0, sizeof(struct certattrmatch));

matchcopy = stringcopy(match,0);
Expand Down

0 comments on commit edd2772

Please sign in to comment.