|Subject:||RE: Invalid use of const pointer?|
|Date:||Tue, 18 Jan 2022 10:56:40 -0500|
Hmmm… I just took another look and realized I missed the reassignment of the “p” pointer on line 577 (to depname) before p is used to modify the string. Sorry for the confusion. I don’t think there is a serious issue here.
I could recommend changing line 557 to something like:
const char * cp = strchr (nptr, ‘%’);
and then changing all occurrences of p to cp up to line 574. This would keep the const pointer pure within the smaller scope and may help prevent someone in the future from attempting an invalid change. Just a suggestion. I realize it’s a pretty unimportant change.
BTW: In another note, Jon Forrest responded to this thread. I’m not sure what that is about.
Sent from Mail for Windows
From: Paul Smith
On Sun, 2022-01-09 at 20:02 -0500, Joe Filion wrote:
> If interested, I found another similar construct in another area of
> the code. Don’t worry, this appears to be the last one.
> On line 557 of implicit.c:
> p = strchr (nptr, '%');
> nptr is a const pointer, but p is used as a non-const pointer later
> on and modifies the string.
I see this line, but I don't see where p is used to modify the string.
Maybe I am missing something? Can you show where the modification
happens, not just the strchr()?
|[Prev in Thread]||Current Thread||[Next in Thread]|