=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rusers/rusers.c,v retrieving revision 1.28 retrieving revision 1.29 diff -c -r1.28 -r1.29 *** src/usr.bin/rusers/rusers.c 2007/05/25 21:27:16 1.28 --- src/usr.bin/rusers/rusers.c 2007/09/02 15:19:34 1.29 *************** *** 1,4 **** ! /* $OpenBSD: rusers.c,v 1.28 2007/05/25 21:27:16 krw Exp $ */ /* * Copyright (c) 2001, 2003 Todd C. Miller --- 1,4 ---- ! /* $OpenBSD: rusers.c,v 1.29 2007/09/02 15:19:34 deraadt Exp $ */ /* * Copyright (c) 2001, 2003 Todd C. Miller *************** *** 47,53 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: rusers.c,v 1.28 2007/05/25 21:27:16 krw Exp $"; #endif /* not lint */ #include --- 47,53 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: rusers.c,v 1.29 2007/09/02 15:19:34 deraadt Exp $"; #endif /* not lint */ #include *************** *** 260,266 **** if (up->uia_cnt == 0) ut = NULL; ! else if ((ut = malloc(up->uia_cnt * sizeof(*ut))) == NULL) err(1, NULL); entry->users = ut; entry->count = up->uia_cnt; --- 260,266 ---- if (up->uia_cnt == 0) ut = NULL; ! else if ((ut = calloc(up->uia_cnt, sizeof(*ut))) == NULL) err(1, NULL); entry->users = ut; entry->count = up->uia_cnt; *************** *** 315,321 **** if (up3->utmp_array_len == 0) ut = NULL; ! else if ((ut = malloc(up3->utmp_array_len * sizeof(*ut))) == NULL) err(1, NULL); entry->users = ut; entry->count = up3->utmp_array_len; --- 315,321 ---- if (up3->utmp_array_len == 0) ut = NULL; ! else if ((ut = calloc(up3->utmp_array_len, sizeof(*ut))) == NULL) err(1, NULL); entry->users = ut; entry->count = up3->utmp_array_len; *************** *** 689,695 **** for (i = 0, count = 0; i < nentries; i++) count += hostinfo[i].count; ! new_hostinfo = (struct host_info *)malloc(sizeof(*entry) * count); if (new_hostinfo == NULL) err(1, NULL); for (i = 0, entry = new_hostinfo; i < nentries; i++) { --- 689,695 ---- for (i = 0, count = 0; i < nentries; i++) count += hostinfo[i].count; ! new_hostinfo = (struct host_info *)calloc(sizeof(*entry), count); if (new_hostinfo == NULL) err(1, NULL); for (i = 0, entry = new_hostinfo; i < nentries; i++) {