aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-14 03:21:10 -0500
committerDavid S. Miller <davem@davemloft.net>2013-11-14 16:50:20 -0500
commitf9a23c84486ed350cce7bb1b2828abd1f6658796 (patch)
tree3a116595363c0e0bf4b8fb12399255cc780ad4bc
parent9434266f2c645d4fcf62a03a8e36ad8075e37943 (diff)
isdnloop: use strlcpy() instead of strcpy()
These strings come from a copy_from_user() and there is no way to be sure they are NUL terminated. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index baf2686aa8eb..02125e6a9109 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -1083,8 +1083,10 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
1083 spin_unlock_irqrestore(&card->isdnloop_lock, flags); 1083 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1084 return -ENOMEM; 1084 return -ENOMEM;
1085 } 1085 }
1086 for (i = 0; i < 3; i++) 1086 for (i = 0; i < 3; i++) {
1087 strcpy(card->s0num[i], sdef.num[i]); 1087 strlcpy(card->s0num[i], sdef.num[i],
1088 sizeof(card->s0num[0]));
1089 }
1088 break; 1090 break;
1089 case ISDN_PTYPE_1TR6: 1091 case ISDN_PTYPE_1TR6:
1090 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95", 1092 if (isdnloop_fake(card, "DRV1.04TC-1TR6-CAPI-CNS-BASIS-29.11.95",
@@ -1097,7 +1099,7 @@ isdnloop_start(isdnloop_card *card, isdnloop_sdef *sdefp)
1097 spin_unlock_irqrestore(&card->isdnloop_lock, flags); 1099 spin_unlock_irqrestore(&card->isdnloop_lock, flags);
1098 return -ENOMEM; 1100 return -ENOMEM;
1099 } 1101 }
1100 strcpy(card->s0num[0], sdef.num[0]); 1102 strlcpy(card->s0num[0], sdef.num[0], sizeof(card->s0num[0]));
1101 card->s0num[1][0] = '\0'; 1103 card->s0num[1][0] = '\0';
1102 card->s0num[2][0] = '\0'; 1104 card->s0num[2][0] = '\0';
1103 break; 1105 break;