Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search: data too long for column 'ipaddress' #4691

Open
da-anda opened this issue Apr 26, 2023 · 3 comments
Open

Search: data too long for column 'ipaddress' #4691

da-anda opened this issue Apr 26, 2023 · 3 comments

Comments

@da-anda
Copy link

da-anda commented Apr 26, 2023

I came across this error in the mybb logfile today. Any ideas why the IP address (redacted, but same length) might be too long? The DB column seems to be varbinary(16) while the PHP method used to convert IP into a binary representation can return 32bit or 128bit strings (https://www.php.net/manual/en/function.inet-pton.php). Is the DB field simply way too small in general? But this error doesn't occur all the time, just randomly it seems. And what's with the X before the actual IP value?

specs:

  • MyBB 1.8.33
  • PHP 7.4.33
  • MySQL 8.0.32
  • View Unread Posts 1.14
<error>                                                                                                                                                                                                                                 
        <dateline>1682496541</dateline>                                                                                                                                                                                                 
        <script></script>                                                                                                                                                                                                               
        <line>0</line>                                                                                                                                                                                                                  
        <type>20</type>                                                                                                                                                                                                                 
        <friendly_type>MyBB SQL Error</friendly_type>                                                                                                                                                                                   
        <message>SQL Error: 1406 - Data too long for column 'ipaddress' at row 1                                                                                                                                                        
Query:                                                                                                                                                                                                                                  
                        INSERT                                                                                                                                                                                                          
                        INTO mybb_searchlog (`sid`,`uid`,`dateline`,`ipaddress`,`threads`,`posts`,`resulttype`,`querycache`,`keywords`)                                                                                          
                        VALUES ('a9cd5f5016b36493e59067f2070b66a3','0000000',1682496541,X'0000000000000f0c000c0c00cc000f0f000f','','','threads','1 < 0','')                                                                              
                </message>                                                                                                                                                                                                              
        <back_trace>#0  errorHandler->error() called at [/inc/db_mysqli.php:606]                                                                                                                                                        
#1  DB_MySQLi->error() called at [/inc/db_mysqli.php:342]                                                                                                                                                                               
#2  DB_MySQLi->query() called at [/inc/db_mysqli.php:375]                                                                                                                                                                               
#3  DB_MySQLi->write_query() called at [/inc/db_mysqli.php:839]                                                                                                                                                                         
#4  DB_MySQLi->insert_query() called at [/inc/plugins/unreadPosts.php:493]                                                                                                                                                              
#5  unreadPosts::doSearch() called at [/inc/class_plugins.php:136]                                                                                                                                                                      
#6  pluginSystem->run_hooks() called at [/search.php:1747]                                                                                                                                                                              
</back_trace>                                                                                                                                                                                                                           
</error>
@Stefan-MyBB
Copy link
Contributor

Stefan-MyBB commented Apr 26, 2023

The DB column seems to be varbinary(16) while the PHP method used to convert IP into a binary representation can return 32bit or 128bit strings (https://www.php.net/manual/en/function.inet-pton.php). Is the DB field simply way too small in general?

A varbinary(16) field can store 16 bytes, which corresponds to 128 bits. Valid IP addresses cannot be longer than that.

@da-anda
Copy link
Author

da-anda commented Apr 26, 2023

which means that it had to be an invalid IP? Or that PHP created an invalid return value? The preceding X seems a bit odd, unless that is a marker added by MySQL to highlight the affected value?

@Sama34
Copy link
Contributor

Sama34 commented May 27, 2023

The X is odd but correct. Unless you come across multiple occurrences of the issue you describe I won't be concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants