Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 95 15:25:33 +0900
From:      Mihoko Tanaka <m_tanaka@pa.yokogawa.co.jp>
To:        freebsd-hackers@freebsd.org
Subject:   ipcs bug
Message-ID:  <9512120625.AA08759@cabbage.pa.yokogawa.co.jp>

next in thread | raw e-mail | index | archive | help

Hi all,

I found a trouble in 'ipcs' command.
If SHMMNI is bigger than MSGMNI, ipcs occurs core dump.
The 'ipcs' allocates the buffer for the shared memory
information , but its size is wrong.

In /usr/src/usr.bin/ipcs/ipcs.c:

       if (display & SHMINFO) {
              struct shmid_ds *xshmids;

               kvm_read(kd, symbols[X_SHMSEGS].n_value, &shmsegs, sizeof(shmsegs));
               xshmids = malloc(sizeof(struct shmid_ds) * msginfo.msgmni);
                                                          ~~~~~~~~~~~~~~~


I think that it should be 'shminfo.msgmni' 

----------------- cut here ----------------------------------

--- ipcs.c	Mon Sep 19 19:24:38 1994
+++ ipcs.c.new	Tue Dec 12 15:08:07 1995
@@ -310,7 +310,7 @@
 			struct shmid_ds *xshmids;
 
 			kvm_read(kd, symbols[X_SHMSEGS].n_value, &shmsegs, sizeof(shmsegs));
-			xshmids = malloc(sizeof(struct shmid_ds) * msginfo.msgmni);
+			xshmids = malloc(sizeof(struct shmid_ds) * shminfo.shmmni);
 			kvm_read(kd, (u_long) shmsegs, xshmids, sizeof(struct shmid_ds) *
 			    shminfo.shmmni);

----------------- cut here ----------------------------------

--
Mihoko Tanaka 
<m_tanaka@pa.yokogawa.co.jp>     
	



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9512120625.AA08759>