Stats can't go past 25, period. They actually CAN be temporarily boosted higher than that, but they'll be *effectively* 25 even if they're higher.
For instance... you have 18 INT, and drink 4 Genius Potions (+4 each). You're now at (internally) 34 int, but you're still effectively at 25. If you get hit by a mindflayer once (-5 int) you won't see any change, but if you get hit twice, you'll go down to 24. However, it's pretty rare that you would have to worry about "wasted" stat points, simply due to how most of the spells and bonuses operate.
Other than STR and CON there's not much benefit to going past 19 though, so it's not really a big deal. The 2nd edition AD&D system doesn't really reward stat-maxing the same way a lot of other systems do. Your max stats at creation are 18 +/- your racial bonuses, but there's a couple of ways to legitimately raise some of them ingame.