rtas_errd: Fix segfault in test path
rtas_errd: Fix segfault in test path

RTAS events size should be <= 4096 bytes. We hit buffer
overflow when test file contains more than 4096 bytes.

This patch fixes this issue by returning "invalid file" when
the file size is > 4096.

Output without this patch :

llm63:/tmp/ppc64-diag/rtas_errd # ./rtas_errd -d -f /var/log/platform
DEBUG: Configuring Minimum Processors to 1.
DEBUG: Configuring Minimum Entitled Capacity to 5.
DEBUG: Configuring Scanlog Dump Path to "/var/log/".
DEBUG: Configuring Platform Dump Path to "/var/log/dump/".
DEBUG: Configuring the Auto Restart Policy to 1.
DEBUG: update_rtas_msgs(): /var/log/messages does not conatin any RTAS events
Segmentation fault

Output with this patch:

llm63:/tmp/ppc64-diag/rtas_errd # ./rtas_errd -d -f /var/log/platform
DEBUG: Configuring Minimum Processors to 1.
DEBUG: Configuring Minimum Entitled Capacity to 5.
DEBUG: Configuring Scanlog Dump Path to "/var/log/".
DEBUG: Configuring Platform Dump Path to "/var/log/dump/".
DEBUG: Configuring the Auto Restart Policy to 1.
DEBUG: update_rtas_msgs(): /var/log/messages does not conatin any RTAS events
DEBUG: Invalid test file.
DEBUG: Invalid test file.
DEBUG: Invalid test file.
DEBUG: Could not read error log file.
DEBUG: The rtas_errd daemon is exiting.

Signed-off-by: Vasant Hegde <a6d753843573f7bfed5075c1e875b0be8007a0ab@linux.vnet.ibm.com>

leitao/ppc64-diag,leitao/ppc64-diag,leitao/ppc64-diag,tyreld/ppc64-diag,leitao/ppc64-diag,tyreld/ppc64-diag,tyreld/ppc64-diag,tyreld/ppc64-diag