@@ -1326,21 +1326,21 @@ int datum_protocol_pow(void *arg) {
13261326
13271327 char * const username = (char * )& msg [i ];
13281328 if (((!datum_config .datum_pool_pass_full_users ) && (!datum_config .datum_pool_pass_workers )) || pow -> username [0 ] == '\0' ) {
1329- j = snprintf (username , 385 , "%s" , datum_config .mining_pool_address );
1329+ j = snprintf (username , DATUM_PROTOCOL_MAX_USERNAME_LEN + 1 , "%s" , datum_config .mining_pool_address );
13301330 } else if (datum_config .datum_pool_pass_full_users && pow -> username [0 ] != '.' ) {
13311331 // TODO: Make sure the usernames are addresses, and if not use one of the configured addresses
1332- j = snprintf (username , 385 , "%s" , pow -> username );
1332+ j = snprintf (username , DATUM_PROTOCOL_MAX_USERNAME_LEN + 1 , "%s" , pow -> username );
13331333 } else {
13341334 // append the miner's username to the configured address as .workername
1335- j = snprintf (username , 385 , "%s%s%s" , datum_config .mining_pool_address , (pow -> username [0 ] == '.' ) ? "" : "." , pow -> username );
1335+ j = snprintf (username , DATUM_PROTOCOL_MAX_USERNAME_LEN + 1 , "%s%s%s" , datum_config .mining_pool_address , (pow -> username [0 ] == '.' ) ? "" : "." , pow -> username );
13361336 }
13371337 if (j < 0 ) {
13381338 DLOG_ERROR ("Unexpected error copying username to POW!" );
13391339 // Still submit it without a username in case it's a block
13401340 username [0 ] = '\0' ;
13411341 j = 0 ;
13421342 }
1343- if (j > 384 ) j = 384 ;
1343+ if (j > DATUM_PROTOCOL_MAX_USERNAME_LEN ) j = DATUM_PROTOCOL_MAX_USERNAME_LEN ;
13441344 i += j + 1 ; // including final null byte
13451345
13461346 // reserve 4 bytes for future use
0 commit comments