Dear R developers,

The following patch should fix a memory allocation bug:

Index: src/modules/internet/sockconn.c
===================================================================
--- src/modules/internet/sockconn.c     (revision 45828)
+++ src/modules/internet/sockconn.c     (working copy)
@@ -174,7 +174,7 @@
 
     new = (Rconnection) malloc(sizeof(struct Rconn));
     if(!new) error(_("allocation of socket connection failed"));
-    new->class = (char *) malloc(strlen("socket") + 1);
+    new->class = (char *) malloc(strlen("sockconn") + 1);
     if(!new->class) {
        free(new);
        error(_("allocation of socket connection failed"));


The in release 45780 there has been changed a strcpy command without
changing the size of the character array.
The following diff also contains the above change to show the problem:

Index: src/modules/internet/sockconn.c
===================================================================
--- src/modules/internet/sockconn.c     (revision 45779)
+++ src/modules/internet/sockconn.c     (working copy)
@@ -174,12 +174,12 @@
 
     new = (Rconnection) malloc(sizeof(struct Rconn));
     if(!new) error(_("allocation of socket connection failed"));
-    new->class = (char *) malloc(strlen("socket") + 1);
+    new->class = (char *) malloc(strlen("sockconn") + 1);
     if(!new->class) {
        free(new);
        error(_("allocation of socket connection failed"));
     }
-    strcpy(new->class, "socket");
+    strcpy(new->class, "sockconn");
     new->description = (char *) malloc(strlen(host) + 10);
     if(!new->description) {
        free(new->class); free(new);

$ svn info
Path: .
URL: https://svn.R-project.org/R/trunk
Repository Root: https://svn.R-project.org/R
Repository UUID: 00db46b3-68df-0310-9c12-caf00c1e9a41
Revision: 45828
Node Kind: directory
Schedule: normal
Last Changed Author: hornik
Last Changed Rev: 45827
Last Changed Date: 2008-06-03 08:44:26 +0200 (Tue, 03 Jun 2008)



Josef

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to