unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Terje Rosten <terjeros@phys.ntnu.no>
Cc: emacs-devel@gnu.org
Subject: Re: Let's tell we are using GTK+
Date: Tue, 19 Aug 2003 12:46:33 +0200	[thread overview]
Message-ID: <yoj7k596i2e.fsf@igor.phys.ntnu.no> (raw)
In-Reply-To: <sgd65ku3rpu.fsf@occarina.pna.cwi.nl>

* Lute Kamstra
|
| > +  {
| > +    char gtk_version[8];
| > +    sprintf (gtk_version, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION,
| > +	     GTK_MICRO_VERSION);
| > +    Vgtk_version_string = build_string (gtk_version);
| > +  }
| 
| this seems vulnerable to a buffer overflow.

That's right. In a updated patch I increased to gtk_version[12], but
that's not large enough if a GTK+ release is named e.g 2.2.cvs20030819.


| It is acceptable to use snprintf instead, or isn't that portable
| enough?  (I'm not really intimate with C.)  What could be used
| instead, a larger string?

What about using glib? If GTK+ is available then is glib available
too. A updated patch using the glib function g_snprintf is included.


 - Terje


Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.5348
diff -c -r1.5348 ChangeLog
*** lisp/ChangeLog	18 Aug 2003 22:46:02 -0000	1.5348
--- lisp/ChangeLog	19 Aug 2003 10:42:16 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-08-18 Terje Rosten <terjeros@phys.ntnu.no>
+ 
+ 	* version.el (emacs-version): Check for gtk. Include gtk version
+ 	info.
+ 
  2003-08-18  Luc Teirlinck  <teirllm@mail.auburn.edu>
  
  	* wid-edit.el (widget-echo-help): Make it handle expressions that
Index: lisp/version.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/version.el,v
retrieving revision 2.32
diff -c -r2.32 version.el
*** lisp/version.el	4 Feb 2003 12:12:31 -0000	2.32
--- lisp/version.el	19 Aug 2003 10:42:16 -0000
***************
*** 62,67 ****
--- 62,69 ----
  		 (cond ((featurep 'motif)
  			(concat ", " (substring motif-version-string 4)))
  		       ((featurep 'x-toolkit) ", X toolkit")
+ 		       ((featurep 'gtk)
+ 			(concat ", GTK+ " gtk-version-string))
  		       (t ""))
  		 (if (and (boundp 'x-toolkit-scroll-bars)
  			  (memq x-toolkit-scroll-bars '(xaw xaw3d)))
Index: src/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/src/ChangeLog,v
retrieving revision 1.3335
diff -c -r1.3335 ChangeLog
*** src/ChangeLog	17 Aug 2003 00:25:37 -0000	1.3335
--- src/ChangeLog	19 Aug 2003 10:42:18 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2003-08-18  Terje Rosten <terjeros@phys.ntnu.no>
+ 
+ 	* xfns.c (Vgtk_version_string): New variable.
+ 	(syms_of_xfns): DEFVAR_LISP it. Provide gtk.
+ 
  2003-08-16  Richard M. Stallman  <rms@gnu.org>
  
  	* editfns.c (Fencode_time): Doc fix.
Index: src/xfns.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xfns.c,v
retrieving revision 1.590
diff -c -r1.590 xfns.c
*** src/xfns.c	31 Jul 2003 16:10:53 -0000	1.590
--- src/xfns.c	19 Aug 2003 10:42:19 -0000
***************
*** 125,130 ****
--- 125,138 ----
  
  #endif /* USE_X_TOOLKIT */
  
+ #ifdef USE_GTK
+ 
+ /* GTK+ version info */
+ 
+ static Lisp_Object Vgtk_version_string;
+ 
+ #endif /* USE_GTK */
+ 
  #ifdef HAVE_X11R4
  #define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
  #else
***************
*** 10885,10890 ****
--- 10893,10911 ----
    Vmotif_version_string = build_string (XmVERSION_STRING);
  #endif /* USE_MOTIF */
  #endif /* USE_X_TOOLKIT */
+ 
+ #ifdef USE_GTK
+   Fprovide (intern ("gtk"), Qnil);
+ 
+   DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,
+                doc: /* Version info for GTK+.  */);
+   {
+     char gtk_version[12];
+     g_snprintf (gtk_version, sizeof (gtk_version), "%d.%d.%d",
+                 GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+     Vgtk_version_string = build_string (gtk_version);
+   }
+ #endif /* USE_GTK */
  
    /* X window properties.  */
    defsubr (&Sx_change_window_property);

  reply	other threads:[~2003-08-19 10:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-03 15:14 Let's tell we are using GTK+ Terje Rosten
2003-08-04  1:20 ` Miles Bader
2003-08-04  7:33   ` Terje Rosten
2003-08-04 17:31   ` Paul Jarc
2003-08-05  1:27     ` Miles Bader
2003-08-05  4:42     ` Stephen J. Turnbull
2003-08-05 19:15   ` Richard Stallman
2003-08-05 23:04     ` Kenichi Handa
2003-08-05 23:59       ` Masatake YAMATO
2003-08-06  7:56       ` Terje Rosten
2003-08-04  8:33 ` Lute Kamstra
2003-08-04 19:33   ` Terje Rosten
2003-08-19  9:46     ` Lute Kamstra
2003-08-19 10:46       ` Terje Rosten [this message]
2003-08-19 12:34         ` Lute Kamstra
2003-08-19 13:39       ` José Roberto B. de A. Monteiro
2003-08-19 14:31       ` Betoes
2003-08-20 18:24       ` Betoes
2003-08-21  9:59         ` Andreas Schwab
2003-08-24  0:10           ` Richard Stallman
2003-08-24 10:28             ` Lute Kamstra
2003-08-22 14:38         ` Richard Stallman
2003-08-23 20:07           ` Simon Josefsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yoj7k596i2e.fsf@igor.phys.ntnu.no \
    --to=terjeros@phys.ntnu.no \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).