diff options
author | Liad Kaufman | 2014-01-27 16:34:23 +0200 |
---|---|---|
committer | Emmanuel Grumbach | 2014-02-03 22:23:42 +0200 |
commit | 84b0312eee685bd0b2ca250dcea7049c8be4b655 (patch) | |
tree | 14c3544d14d08ef4033a4c3760159ca3d252853f /drivers/net | |
parent | 034846cfd23e00a70b48363d70dccc3f8d537053 (diff) |
iwlwifi: fix potential buffer overrun in fw name
Fix a potential buffer overrun when creating the fw name
in drv->firmware_name by setting a maximal length to the
char array copied to it.
The maximal length is also updated to 32 rather than 25 to
keep both 32bit and 64bit alignment without requiring
padding to the struct it is in.
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-drv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index c3728163be46..b3bc30b4292b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c @@ -128,7 +128,7 @@ struct iwl_drv { const struct iwl_cfg *cfg; int fw_index; /* firmware we're trying to load */ - char firmware_name[25]; /* name of firmware file to load */ + char firmware_name[32]; /* name of firmware file to load */ struct completion request_firmware_complete; @@ -237,7 +237,8 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first) return -ENOENT; } - sprintf(drv->firmware_name, "%s%s%s", name_pre, tag, ".ucode"); + snprintf(drv->firmware_name, sizeof(drv->firmware_name), "%s%s.ucode", + name_pre, tag); IWL_DEBUG_INFO(drv, "attempting to load firmware %s'%s'\n", (drv->fw_index == UCODE_EXPERIMENTAL_INDEX) |