When using varchar for storage, your code must truncate values to the maximum length before they are sent to the database layer if there is any chance the data may exceed the allowed size.
In Drupal 6, MySQL and older versions of PostgreSQL would silently truncate these values. Drupal 7 runs MySQL in strict mode and includes support for more database types. Instead of truncating, it will throw a PDO Exception if attempting to write data exceeding the maximum length of the varchar.
In some circumstances it may be better to increase the size of the varchar or change the type of the column to text. However note that, on MySQL, text columns can negatively affect performance if they are included in a query that creates a temporary table.
Note that varchar columns up to 4,000 characters are supported by every database server that Drupal supports (including Microsoft SQL Server and Oracle).