Skip to content

Commit

Permalink
Fix: buffer overflow warning in python bindings
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Galarneau <[email protected]>
  • Loading branch information
jgalar committed Nov 12, 2017
1 parent b84ff46 commit bbf3690
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extras/bindings/swig/python/lttng.i.in
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ struct lttng_channel {
%extend {
char *__repr__() {
static char temp[512];
sprintf(temp, "lttng.Channel; name('%s'), enabled(%s)",
snprintf(temp, sizeof(temp), "lttng.Channel; name('%s'), enabled(%s)",
$self->name, $self->enabled ? "True" : "False");
return &temp[0];
}
Expand All @@ -994,8 +994,8 @@ struct lttng_session {

%extend {
char *__repr__() {
static char temp[512];
sprintf(temp, "lttng.Session; name('%s'), path('%s'), enabled(%s)",
static char temp[PATH_MAX + NAME_MAX + 512];
snprintf(temp, sizeof(temp), "lttng.Session; name('%s'), path('%s'), enabled(%s)",
$self->name, $self->path,
$self->enabled ? "True" : "False");
return &temp[0];
Expand Down

0 comments on commit bbf3690

Please sign in to comment.