Skip to content

Commit

Permalink
plugins/radius: Avoid buffer-overrun in rc_avpair_tostr for PW_TYPE_D…
Browse files Browse the repository at this point in the history
…ATE (#506)

Closes: #499

Signed-off-by: Jaco Kroon <[email protected]>
  • Loading branch information
jkroonza authored Aug 17, 2024
1 parent 04e6b8d commit cb59395
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pppd/plugins/radius/avpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ int rc_avpair_tostr (VALUE_PAIR *pair, char *name, int ln, char *value, int lv)
struct in_addr inad;
unsigned char *ptr;
char *str;
time_t tmptime;

*name = *value = '\0';

Expand Down Expand Up @@ -752,8 +753,9 @@ int rc_avpair_tostr (VALUE_PAIR *pair, char *name, int ln, char *value, int lv)
break;

case PW_TYPE_DATE:
tmptime = pair->lvalue;
strftime (buffer, sizeof (buffer), "%m/%d/%y %H:%M:%S",
gmtime ((time_t *) & pair->lvalue));
gmtime (&tmptime));
strncpy(value, buffer, lv-1);
break;

Expand Down

0 comments on commit cb59395

Please sign in to comment.