Skip to content

Commit

Permalink
pass the length if the param is invalid
Browse files Browse the repository at this point in the history
closes #333
  • Loading branch information
stefankueng committed May 24, 2023
1 parent c7dd566 commit dc7bac3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scripting/BasicScriptObject.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of BowPad.
//
// Copyright (C) 2014-2018, 2020-2022 - Stefan Kueng
// Copyright (C) 2014-2018, 2020-2023 - Stefan Kueng
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1619,7 +1619,7 @@ HRESULT BasicScriptObject::ScintillaCommandInvoke(DISPID id, WORD flags, DISPPAR
// return value is a string
auto len = Scintilla().Call(static_cast<Scintilla::Message>(cmd.cmd), p1.intVal);
auto buf = std::make_unique<char[]>(len + 1);
Scintilla().Call(static_cast<Scintilla::Message>(cmd.cmd), p1.intVal, reinterpret_cast<sptr_t>(buf.get()));
Scintilla().Call(static_cast<Scintilla::Message>(cmd.cmd), cmd.p1 == VT_NULL ? len : p1.intVal, reinterpret_cast<sptr_t>(buf.get()));
buf[len] = 0;
ret->vt = VT_BSTR;
ret->bstrVal = _bstr_t(CUnicodeUtils::StdGetUnicode(buf.get()).c_str()).Detach();
Expand Down

0 comments on commit dc7bac3

Please sign in to comment.