sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

GeoipCode2 compile error 047: array sizes do not match, or destination array is too small

Open ambaca opened this issue 2 years ago • 0 comments

Help us help you

  • [ ✔️ ] I have checked that my issue doesn't exist yet.
  • [ ✔️ ] I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • [ ✔️ ] I can always reproduce the issue with the provided description below.

Environment

  • Operating System version: Windows 10 Home
  • Game/AppID (with version if applicable): Counter-Strike: Source (and other games)
  • Current SourceMod version: sourcemod-1.11.0-git6934
  • Current SourceMod snapshot: -
  • Current Metamod: Source snapshot: -
  • [ ❌ ] I have updated SourceMod to the latest version and it still happens.
  • [ ❌ ] I have updated SourceMod to the latest snapshot and it still happens.
  • [ ❌ ] I have updated SourceMM to the latest snapshot and it still happens.

Description

Around two years ago, after GeoIP2 update #1245 functions like GeoipCode2 and GeoipCode3 string output size is restricted to exactly right size. Otherwise you get compile error.

Before GeoIP2 update, you could have give bigger string, but not anymore.

  • Of course, this can be solved to make two string with correct size,( for each GeoipCode2 and GeoipCode3)

Problematic Code (or Steps to Reproduce)

#include <geoip>

public void OnClientPostAdminCheck(int client)
{
	char IP[16];
	GetClientIP(client, IP, sizeof(IP));

	char CODE[4];

	GeoipCode2(IP, CODE); //: error 047: array sizes do not match, or destination array is too small
}

Logs

  • Please attach in separate files: game output, library logs, kernel logs, and any other supporting information.
  • In case of a crash, please attach minidump or dump analyze output.

ambaca avatar Aug 05 '23 17:08 ambaca