Skip to content
Snippets Groups Projects
user avatar
Eric Chanudet authored
Bugzilla: https://bugzilla.redhat.com/2166789



commit 6c58cf40e3a1d2f47c09d3489857e9476316788a
Author: Florian Fainelli <f.fainelli@gmail.com>
Date:   Mon Jul 25 10:37:54 2022 -0700

    tools/thermal: Fix possible path truncations

    A build with -D_FORTIFY_SOURCE=2 enabled will produce the following warnings:

    sysfs.c:63:30: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
      snprintf(filepath, 256, "%s/%s", path, filename);
                                  ^~
    Bump up the buffer to PATH_MAX which is the limit and account for all of
    the possible NUL and separators that could lead to exceeding the
    allocated buffer sizes.

    Fixes: 94f69966 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>

Signed-off-by: default avatarEric Chanudet <echanude@redhat.com>
7b4f3b85
History
Code owners
Name Last commit Last update
..