iscsi-target: Fix tfc_tpg_nacl_auth_cit configfs length overflow
authorJörn Engel <joern@logfs.org>
Wed, 3 Jul 2013 15:35:11 +0000 (11:35 -0400)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 8 Jul 2013 01:36:49 +0000 (18:36 -0700)
This patch fixes a potential buffer overflow while processing
iscsi_node_auth input for configfs attributes within NodeACL
tfc_tpg_nacl_auth_cit context.

Signed-off-by: Joern Engel <joern@logfs.org>
Cc: stable@vger.kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target_configfs.c

index e251849..88bc805 100644 (file)
@@ -473,7 +473,7 @@ static ssize_t __iscsi_##prefix##_store_##name(                             \
        if (!capable(CAP_SYS_ADMIN))                                    \
                return -EPERM;                                          \
                                                                        \
-       snprintf(auth->name, PAGE_SIZE, "%s", page);                    \
+       snprintf(auth->name, sizeof(auth->name), "%s", page);           \
        if (!strncmp("NULL", auth->name, 4))                            \
                auth->naf_flags &= ~flags;                              \
        else                                                            \