TigerVNC / tigervnc

High performance, multi-platform VNC client and server
https://tigervnc.org
GNU General Public License v2.0
5.17k stars 946 forks source link

format string different from variable #1632

Closed maddin200 closed 1 year ago

maddin200 commented 1 year ago

/vncviewer/parameters.cxx line 436 Code:

  size_t index = 0;
  assert(SERVER_HISTORY_SIZE < 100);
  char indexString[3];

  try {
    while(index < serverHistory.size() && index <= SERVER_HISTORY_SIZE) {
      snprintf(indexString, 3, "%d", index); // <-- check format vs size_t
--- Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/121828336-format-string-different-from-variable?utm_campaign=plugin&utm_content=tracker%2F3557444&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3557444&utm_medium=issues&utm_source=github).
maddin200 commented 1 year ago

same procedure line 525

CendioOssman commented 1 year ago

Hmm... That's odd. We are supposed to have checks for that. Will need to investigate how they missed this.

Thanks for bringing it to our attention!

CendioOssman commented 1 year ago

The lack of warnings is apparently because of gettext. I've filed an issue with them:

https://savannah.gnu.org/bugs/index.php?64384

CendioOssman commented 1 year ago

Fixed in fad215db386d5aa0d40bd99625f99e6bd64f2904.