Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Oct 2000 06:18:52 +0100 (BST)
From:      sa264@cam.ac.uk
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/22343: cad/cider minor fix
Message-ID:  <200010250518.e9P5Iqn02540@sa264.wolfson.cam.ac.uk>

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

>Number:         22343
>Category:       ports
>Synopsis:       cad/cider minor fix
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 27 02:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     AMAKAWA Shuhei
>Release:        FreeBSD 4.1.1-STABLE i386
>Organization:
University of Cambridge
>Environment:

	FreeBSD 4.1.1-STABLE i386

>Description:

	I am the maintainer.
	Prevent possible buffer overflow.
	Use erfc(3).

>How-To-Repeat:

	

>Fix:

New file: files/patch-bm

diff -uNr /usr/ports/cad/cider/Makefile cider/Makefile
--- /usr/ports/cad/cider/Makefile	Fri Jun  2 12:08:47 2000
+++ cider/Makefile	Tue Oct 24 11:54:58 2000
@@ -7,6 +7,7 @@
 
 PORTNAME=	cider
 PORTVERSION=	1.b1
+PORTREVISION=	1
 CATEGORIES=	cad
 MASTER_SITES=	ftp://ic.eecs.berkeley.edu/pub/Cider/new/
 DISTNAME=	cider1b1
diff -uNr /usr/ports/cad/cider/files/patch-ad cider/files/patch-ad
--- /usr/ports/cad/cider/files/patch-ad	Wed Dec 29 21:32:09 1999
+++ cider/files/patch-ad	Tue Oct 24 03:39:05 2000
@@ -1,5 +1,5 @@
 *** spice/common/src/bin/main.c.orig	Sat Mar 12 08:22:28 1994
---- spice/common/src/bin/main.c	Sun Dec 12 14:58:04 1999
+--- spice/common/src/bin/main.c	Tue Oct 24 03:32:20 2000
 ***************
 *** 25,30 ****
 --- 25,37 ----
@@ -46,7 +46,7 @@
   #ifdef BATCH
 ***************
 *** 185,190 ****
---- 202,291 ----
+--- 202,294 ----
   
   #endif
   
@@ -56,6 +56,7 @@
 + prompt()
 + {
 +     static char pbuf[128];
++     int n = sizeof(pbuf);
 +     char *p = pbuf, *s;
 + 
 +     if (cp_interactive == false)
@@ -66,16 +67,18 @@
 +         s = cp_promptstring;
 +     if (cp_altprompt)
 +         s = cp_altprompt;
-+     while (*s) {
++     while (*s && (n > 1)) {
++ 	int w;
 +         switch (strip(*s)) {
 + 	case '!':
-+ 	    p += sprintf(p, "%d", where_history() + 1);
++ 	    w = snprintf(p, n, "%d", where_history() + 1);
++ 	    w = (w >= n) ? n - 1 : w;
++ 	    p += w;
++ 	    n -= w;
 + 	    break;
-+ 	case '\\':
-+ 	    if (*(s + 1)) 
-+ 		p += sprintf(p, "%c", strip(*++s));
 + 	default:
 + 	    *p = strip(*s); ++p;
++ 	    --n;
 + 	    break;
 +         }
 +         s++;
@@ -139,7 +142,7 @@
   void
 ***************
 *** 216,221 ****
---- 317,326 ----
+--- 320,329 ----
   
   #endif
   
@@ -152,7 +155,7 @@
           fprintf(cp_err, "main: Internal Error: jump to zero\n");
 ***************
 *** 236,241 ****
---- 341,353 ----
+--- 344,356 ----
       ARCHsize = 1;
   #endif /* PARALLEL_ARCH */
   
@@ -168,7 +171,7 @@
   #endif
 ***************
 *** 472,478 ****
---- 584,594 ----
+--- 587,597 ----
   #  ifdef HAS_UNIX_SIGS
       /* Set up (void) signal handling */
       if (!ft_batchmode) {
@@ -182,7 +185,7 @@
           (void) signal(SIGTSTP, sigstop);
 ***************
 *** 668,674 ****
---- 784,794 ----
+--- 787,797 ----
       } else {
           (void) setjmp(jbuf);
           cp_interactive = true;
@@ -196,7 +199,7 @@
   #  else /* if BATCH */
 ***************
 *** 708,714 ****
---- 828,838 ----
+--- 831,841 ----
       /* Nutmeg "main" */
       (void) setjmp(jbuf);
       cp_interactive = true;
diff -uNr /usr/ports/cad/cider/files/patch-bc cider/files/patch-bc
--- /usr/ports/cad/cider/files/patch-bc	Wed Dec 29 21:32:13 1999
+++ cider/files/patch-bc	Tue Oct 24 03:39:08 2000
@@ -1,5 +1,5 @@
 *** cider/common/src/bin/main.c.orig	Sat Mar 12 08:20:59 1994
---- cider/common/src/bin/main.c	Mon Dec 13 10:16:13 1999
+--- cider/common/src/bin/main.c	Tue Oct 24 03:37:38 2000
 ***************
 *** 25,30 ****
 --- 25,37 ----
@@ -46,7 +46,7 @@
   #ifdef BATCH
 ***************
 *** 185,190 ****
---- 202,291 ----
+--- 202,294 ----
   
   #endif
   
@@ -56,6 +56,7 @@
 + prompt()
 + {
 +     static char pbuf[128];
++     int n = sizeof(pbuf);
 +     char *p = pbuf, *s;
 + 
 +     if (cp_interactive == false)
@@ -66,16 +67,18 @@
 +         s = cp_promptstring;
 +     if (cp_altprompt)
 +         s = cp_altprompt;
-+     while (*s) {
++     while (*s && (n > 1)) {
++ 	int w;
 +         switch (strip(*s)) {
 + 	case '!':
-+ 	    p += sprintf(p, "%d", where_history() + 1);
++ 	    w = snprintf(p, n, "%d", where_history() + 1);
++ 	    w = (w >= n) ? n - 1 : w;
++ 	    p += w;
++ 	    n -= w;
 + 	    break;
-+ 	case '\\':
-+ 	    if (*(s + 1)) 
-+ 		p += sprintf(p, "%c", strip(*++s));
 + 	default:
 + 	    *p = strip(*s); ++p;
++ 	    --n;
 + 	    break;
 +         }
 +         s++;
@@ -139,7 +142,7 @@
   void
 ***************
 *** 216,221 ****
---- 317,326 ----
+--- 320,329 ----
   
   #endif
   
@@ -152,7 +155,7 @@
           fprintf(cp_err, "main: Internal Error: jump to zero\n");
 ***************
 *** 236,241 ****
---- 341,353 ----
+--- 344,356 ----
       ARCHsize = 1;
   #endif /* PARALLEL_ARCH */
   
@@ -168,7 +171,7 @@
   #endif
 ***************
 *** 472,478 ****
---- 584,594 ----
+--- 587,597 ----
   #  ifdef HAS_UNIX_SIGS
       /* Set up (void) signal handling */
       if (!ft_batchmode) {
@@ -182,7 +185,7 @@
           (void) signal(SIGTSTP, sigstop);
 ***************
 *** 668,674 ****
---- 784,794 ----
+--- 787,797 ----
       } else {
           (void) setjmp(jbuf);
           cp_interactive = true;
@@ -196,7 +199,7 @@
   #  else /* if BATCH */
 ***************
 *** 708,714 ****
---- 828,838 ----
+--- 831,841 ----
       /* Nutmeg "main" */
       (void) setjmp(jbuf);
       cp_interactive = true;
diff -uNr /usr/ports/cad/cider/files/patch-bm cider/files/patch-bm
--- /usr/ports/cad/cider/files/patch-bm	Thu Jan  1 01:00:00 1970
+++ cider/files/patch-bm	Tue Oct 24 12:23:51 2000
@@ -0,0 +1,16 @@
+--- cider/common/src/lib/support/erfc.c.orig	Sat Jan 29 19:29:27 1994
++++ cider/common/src/lib/support/erfc.c	Tue Oct 24 12:23:09 2000
+@@ -10,6 +10,7 @@
+ 
+ /* erfc computes the erfc(x) the code is from sedan's derfc.f */
+ 
++#ifdef HAS_NO_ERFC
+ double erfc ( x )
+ double x;
+ {
+@@ -46,4 +47,4 @@
+         return( 1.0 - sum2 );
+     }
+ }
+-
++#endif

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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