iscsi-target: Fix tfc_tpg_auth_cit configfs length overflow
authorNicholas Bellinger <nab@linux-iscsi.org>
Sat, 6 Jul 2013 23:48:55 +0000 (16:48 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 8 Jul 2013 01:36:50 +0000 (18:36 -0700)
This patch fixes another potential buffer overflow while processing
iscsi_node_auth input for configfs attributes in v3.11 for-next
TPG tfc_tpg_auth_cit context.

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

index 88bc805e998f89895007d56d98a1788c0e2c4a85..b41d4786fa08468353631bd34e0e09df5f51608f 100644 (file)
@@ -1081,7 +1081,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                                                                    \