ad_click table record insert fails if user agent string is longer than 255 chars

Created on 8 June 2010, almost 15 years ago
Updated 19 September 2024, 7 months ago

if ad.module line 240:
db_query("INSERT INTO {ad_clicks} (aid, uid, status, hostname, user_agent, adgroup, extra, hostid, url, timestamp) VALUES (%d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d)", $aid, $user->uid, $status, ip_address(),$_SERVER['HTTP_USER_AGENT'], $group, $extra, $hostid, $url, time());

is changed like this:
db_query("INSERT INTO {ad_clicks} (aid, uid, status, hostname, user_agent, adgroup, extra, hostid, url, timestamp) VALUES (%d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', %d)", $aid, $user->uid, $status, ip_address(), substr($_SERVER['HTTP_USER_AGENT'], 0, 255), $group, $extra, $hostid, $url, time());

It'd be avoidable. I suppose same goes for url also. Thanks!

πŸ› Bug report
Status

Closed: outdated

Version

2.2

Component

ad module

Created by

πŸ‡ΊπŸ‡ΈUnited States mehmeta

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • πŸ‡©πŸ‡ͺGermany lrwebks Porta Westfalica

    Drupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!

Production build 0.71.5 2024