Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: building latest sources



On Tue, Mar 02, 2004 at 07:17:21PM +0100, Oliver Kiddle wrote:
> -	unmetafy(x, &cutbuf.len);
> +	unmetafy(x, (int *)&cutbuf.len);
[...]
> -	    unmetafy(*p, &kptr->len);
> +	    unmetafy(*p, (int *)&kptr->len);

You can't just cast away an error like that.  This code was (and is)
improperly assuming that an int can be put into a size_t memory
location.  Attached is my fix.

..wayne..
--- Src/Zle/zle_params.c	3 Mar 2004 11:05:46 -0000	1.13
+++ Src/Zle/zle_params.c	3 Mar 2004 18:30:10 -0000
@@ -365,7 +365,9 @@ set_cutbuffer(Param pm, char *x)
 	free(cutbuf.buf);
     cutbuf.flags = 0;
     if (x) {
-	unmetafy(x, (int *)&cutbuf.len);
+	int n;
+	unmetafy(x, &n);
+	cutbuf.len = n;
 	cutbuf.buf = zalloc(cutbuf.len);
 	memcpy((char *)cutbuf.buf, x, cutbuf.len);
 	free(x);
@@ -418,9 +420,10 @@ set_killring(Param pm, char **x)
 	kringsize = arrlen(x);
 	kring = (Cutbuffer)zshcalloc(kringsize * sizeof(struct cutbuffer));
 	for (p = x; *p; p++) {
-	    int len = strlen(*p);
+	    int n, len = strlen(*p);
 	    kptr = kring + kpos;
-	    unmetafy(*p, (int *)&kptr->len);
+	    unmetafy(*p, &n);
+	    kptr->len = n;
 	    kptr->buf = (char *)zalloc(kptr->len);
 	    memcpy(kptr->buf, *p, kptr->len);
 	    zfree(*p, len+1);


Messages sorted by: Reverse Date, Date, Thread, Author