After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 60933 - Array overrun
Array overrun
Status: RESOLVED FIXED
Product: gmc
Classification: Deprecated
Component: general
unspecified
Other IRIX
: Normal normal
: ---
Assigned To: Andrew V. Samoilov
Andrew V. Samoilov
Depends on:
Blocks:
 
 
Reported: 2001-09-22 06:11 UTC by drk
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description drk 2001-09-22 06:11:58 UTC
Building mc/4.5.54 for SGI IRIX 6.5, I noticed a couple places
where the code was writing off the end of it's arrays.  Here's a fix:

--- ./vfs/cpio.c	Fri Mar  9 02:30:04 2001
+++ ../mc-4.5.54/./vfs/cpio.c	Fri Sep 21 16:27:26 2001
@@ -300,7 +300,7 @@
     if((len = mc_read(super->u.cpio.fd, (void *)buf, HEAD_LENGTH)) <
HEAD_LENGTH)
 	return STATUS_EOF;
     CPIO_POS(super) += len;
-    buf[HEAD_LENGTH + 1] = 0;
+    buf[HEAD_LENGTH] = NULL;
 
     if(sscanf((void *)buf,
"070707%6lo%6lo%6lo%6lo%6lo%6lo%6lo%11lo%6lo%11lo",
 	      &hd.c_dev, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
@@ -348,7 +348,7 @@
     if((len = mc_read(super->u.cpio.fd, buf, HEAD_LENGTH)) < HEAD_LENGTH)
 	return STATUS_EOF;
     CPIO_POS(super) += len;
-    buf[HEAD_LENGTH + 1] = 0;
+    buf[HEAD_LENGTH] = '\0';
 
     if(sscanf(buf,
"%6ho%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx%8lx",
 	      &hd.c_magic, &hd.c_ino, &hd.c_mode, &hd.c_uid, &hd.c_gid,
Comment 1 Andrew V. Samoilov 2001-10-25 14:16:41 UTC
Replace NULL with 0. Applied to CVS. Thank you!
Please email your bug reports and patches to mc-devel@gnome.org

Regards,
Andrew V. Samoilov.
Comment 2 Kjartan Maraas 2002-01-13 01:16:18 UTC
Close this?