diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-01 19:51:31 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-02-01 19:51:31 -0500 | 
| commit | 9010012aa140c0301d1ae1121a0f4d16b22dcb0b (patch) | |
| tree | 5e2df0123210527f6428f96d8f2ffc338e9340da /lib/ptm_lib.c | |
| parent | 3d217741c3cc441a9ffb3d2f903c4fb34292638f (diff) | |
lib: Fix possible array overrun
It is possible if the hostname is > 32
characters that we would just overrun the
client_name data structure.  Truncate
the hostname string to 31 characters (to allow for NULL)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/ptm_lib.c')
| -rw-r--r-- | lib/ptm_lib.c | 2 | 
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c index 0666797fad..a93d7b8476 100644 --- a/lib/ptm_lib.c +++ b/lib/ptm_lib.c @@ -458,7 +458,7 @@ ptm_lib_register(char *client_name,      hdl = calloc(1, sizeof(*hdl));      if (hdl) { -        strcpy(hdl->client_name, client_name); +        strncpy(hdl->client_name, client_name, PTMLIB_MAXNAMELEN - 1);          hdl->cmd_cb = cmd_cb;          hdl->notify_cb = notify_cb;          hdl->response_cb = response_cb;  | 
