• R/O
  • HTTP
  • SSH
  • HTTPS

linux-2.4.36: Commit

2.4.36-stable kernel tree


Commit MetaInfo

Revisionf76d36ddb1a6da76d46185941f326739cbba5e41 (tree)
Zeit2007-12-10 15:18:34
AutorWilly Tarreau <w@1wt....>
CommiterWilly Tarreau

Log Message

[PATCH] isdn: avoid copying overly-long strings

Backport of 2.6 commit 0f13864e5b24d9cbe18d125d41bfa4b726a82e40 by Karsten Keil

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=9416

Signed-off-by: Willy Tarreau <w@1wt.eu>

Ändern Zusammenfassung

Diff

--- a/drivers/isdn/isdn_net.c
+++ b/drivers/isdn/isdn_net.c
@@ -2159,7 +2159,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
21592159 isdn_net_dev *p;
21602160 isdn_net_phone *n;
21612161 ulong flags;
2162- char nr[32];
2162+ char nr[ISDN_MSNLEN];
21632163 char *my_eaz;
21642164
21652165 /* Search name in netdev-chain */
@@ -2169,8 +2169,10 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
21692169 nr[0] = '0';
21702170 nr[1] = '\0';
21712171 printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n");
2172- } else
2173- strcpy(nr, setup->phone);
2172+ } else {
2173+ strncpy(nr, setup->phone, ISDN_MSNLEN - 1);
2174+ nr[ISDN_MSNLEN - 1] = 0;
2175+ }
21742176 si1 = (int) setup->si1;
21752177 si2 = (int) setup->si2;
21762178 if (!setup->eazmsn[0]) {
@@ -2855,7 +2857,8 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
28552857 chidx = -1;
28562858 }
28572859 }
2858- strcpy(lp->msn, cfg->eaz);
2860+ strncpy(lp->msn, cfg->eaz, sizeof(lp->msn) - 1);
2861+ lp->msn[sizeof(lp->msn) - 1] = 0;
28592862 lp->pre_device = drvidx;
28602863 lp->pre_channel = chidx;
28612864 lp->onhtime = cfg->onhtime;
@@ -3004,7 +3007,8 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone)
30043007 if (p) {
30053008 if (!(n = (isdn_net_phone *) kmalloc(sizeof(isdn_net_phone), GFP_KERNEL)))
30063009 return -ENOMEM;
3007- strcpy(n->num, phone->phone);
3010+ strncpy(n->num, phone->phone, sizeof(n->num) - 1);
3011+ n->num[sizeof(n->num) - 1] = 0;
30083012 n->next = p->local->phone[phone->outgoing & 1];
30093013 p->local->phone[phone->outgoing & 1] = n;
30103014 return 0;
Show on old repository browser