Valhalla Legends Forums Archive | General Programming | Rich Edit control's EM_GETSELTEXT

AuthorMessageTime
BreW
http://msdn2.microsoft.com/en-us/library/bb774190.aspx
Am I crazy, or should wParam be the max buffer length for the char array that you supply the pointer to in the lParam? This message is very poorly designed. What were they thinking, having the wParam not used? This can easily be exploited by just over-selecting text, and the amount of text in a rich edit box could get quite lengthy. To be completely honest, I'm scared to even try it. Somehow I really doubt that Microsoft would make their rich edit message handlers this insecure, so is there a better way to determine how big your buffer should be? Besides using EM_GETTEXTLENGTHEX?
September 14, 2007, 1:04 AM
Barabajagal
How can you over-select text? GetSelText gets the selection, it doesn't set it.
September 14, 2007, 2:38 AM
zorm
EM_EXGETSEL
September 14, 2007, 3:20 AM
BreW
[quote author=Andy link=topic=17021.msg172726#msg172726 date=1189737526]
How can you over-select text? GetSelText gets the selection, it doesn't set it.
[/quote]
Say your buffer is 1024 bytes. You select 1536 characters. Those characters happen to be binary data. You fail, buffer overflow. I was asking if there was a way to determine how big your buffer should be before you use EM_GETSELTEXT.
By the way, thank you Zorm.
September 14, 2007, 7:08 PM

Search