@@ -620,14 +620,15 @@ get_append_property (XSelectionEvent * xsl, unsigned char ** buffer,
620
620
print_debug (D_TRACE , "Got zero length property; end of INCR transfer" );
621
621
return False ;
622
622
} else if (format == 8 ) {
623
- if (* offset + length > * alloc ) {
624
- * alloc = * offset + length ;
623
+ if (* offset + length + 1 > * alloc ) {
624
+ * alloc = * offset + length + 1 ;
625
625
if ((* buffer = realloc (* buffer , * alloc )) == NULL ) {
626
626
exit_err ("realloc error" );
627
627
}
628
628
}
629
629
ptr = * buffer + * offset ;
630
- xs_strncpy (ptr , value , length );
630
+ memcpy (ptr , value , length );
631
+ ptr [length ] = '\0' ;
631
632
* offset += length ;
632
633
print_debug (D_TRACE , "Appended %d bytes to buffer\n" , length );
633
634
} else {
@@ -1299,13 +1300,13 @@ change_property (Display * display, Window requestor, Atom property,
1299
1300
print_debug (D_TRACE , "large data transfer" );
1300
1301
1301
1302
1302
- /* Send a SelectionNotify event of type INCR */
1303
+ /* Send a SelectionNotify event */
1303
1304
ev .type = SelectionNotify ;
1304
1305
ev .display = display ;
1305
1306
ev .requestor = requestor ;
1306
1307
ev .selection = selection ;
1307
1308
ev .time = time ;
1308
- ev .target = incr_atom ; /* INCR */
1309
+ ev .target = target ;
1309
1310
ev .property = property ;
1310
1311
1311
1312
XSelectInput (ev .display , ev .requestor , PropertyChangeMask );
0 commit comments