diff options
author | Neil <nyamatongwe@gmail.com> | 2021-03-29 09:03:04 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2021-03-29 09:03:04 +1100 |
commit | f1ad63380ea954ae42c26d0a4fc0e46574cd9e5f (patch) | |
tree | d0b95dd1e509cc0eca7a353520e9c409c0497195 /win32/PlatWin.cxx | |
parent | ab70e1041cb40c9d807a18ca7abb5c000adf2fdf (diff) | |
download | scintilla-mirror-f1ad63380ea954ae42c26d0a4fc0e46574cd9e5f.tar.gz |
Modify ListBox::GetValue to return a std::string to avoid fixed size buffers
and the possibility of truncation.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index b2b188cb6..5e53b2888 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -2967,7 +2967,7 @@ public: void Select(int n) override; int GetSelection() override; int Find(const char *prefix) override; - void GetValue(int n, char *value, int len) override; + std::string GetValue(int n) override; void RegisterImage(int type, const char *xpm_data) override; void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) override; void ClearRegisteredImages() override; @@ -3122,10 +3122,9 @@ int ListBoxX::Find(const char *) { return LB_ERR; } -void ListBoxX::GetValue(int n, char *value, int len) { +std::string ListBoxX::GetValue(int n) { const ListItemData item = lti.Get(n); - strncpy(value, item.text, len); - value[len-1] = '\0'; + return item.text; } void ListBoxX::RegisterImage(int type, const char *xpm_data) { |