[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Fix runttys segfault

From: Ryan M. Golbeck
Subject: [patch] Fix runttys segfault
Date: Wed, 21 Nov 2001 22:40:07 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i386-debian-linux-gnu)

Here's the fix for the runttys segfaulting.  It was an off by one
error in allocating space to hold an argv vector during construction
of the string for the terminal used.

2001-11-21  Ryan M Golbeck <rmgolbeck@uwaterloo.ca>

    * runttys.c (setup_terminal): Fixed off by one error internal 
    function make_args.

Index: runttys.c
RCS file: /cvsroot/hurd/hurd/daemons/runttys.c,v
retrieving revision 1.3
diff -u -p -r1.3 runttys.c
--- runttys.c   1999/09/19 19:43:31     1.3
+++ runttys.c   2001/11/22 03:36:10
@@ -92,7 +92,7 @@ setup_terminal (struct terminal *t, stru
          size_t len;
          argz_create_sep (line, ' ', &argz, &len);
          argc = argz_count (argz, len);
-         argv = malloc (argc * sizeof (char *));
+         argv = malloc ((argc + 1) * sizeof (char *));
          argz_extract (argz, len, argv);
          return argv;

Ryan Golbeck <rmgolbeck@uwaterloo.ca>
Computer Science
University Of Waterloo

GPG: 1024D/78916B84 
1B1B 2A87 3F00 A7FB 40F3  526D 36CF BA44 7891 6B84

Attachment: pgpltpaPKpxlt.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]