Unverified Commit 93dda653 authored by 郭伟光's avatar 郭伟光 Committed by GitHub
Browse files

config rewrite failed save errno in case of being tainted (#10461)

errno would be potentially tainted during the serverLog() by the file io functions, such as fopen and fflush.
parent 4517fadb
...@@ -3033,8 +3033,10 @@ void configRewriteCommand(client *c) { ...@@ -3033,8 +3033,10 @@ void configRewriteCommand(client *c) {
return; return;
} }
if (rewriteConfig(server.configfile, 0) == -1) { if (rewriteConfig(server.configfile, 0) == -1) {
serverLog(LL_WARNING,"CONFIG REWRITE failed: %s", strerror(errno)); /* save errno in case of being tainted. */
addReplyErrorFormat(c,"Rewriting config file: %s", strerror(errno)); int err = errno;
serverLog(LL_WARNING,"CONFIG REWRITE failed: %s", strerror(err));
addReplyErrorFormat(c,"Rewriting config file: %s", strerror(err));
} else { } else {
serverLog(LL_WARNING,"CONFIG REWRITE executed with success."); serverLog(LL_WARNING,"CONFIG REWRITE executed with success.");
addReply(c,shared.ok); addReply(c,shared.ok);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment