<div dir="ltr">Hi systemd-devel team, <br><br>I am trying to understand where "vbuf" is initialized in function "token_match_attr()" in file udev-rules.c<br><div><br></div><div>Below code snippet : <br></div>static bool<b> token_match_attr</b>(UdevRuleToken *token, sd_device *dev, UdevEvent *event) {<br><div> <b>char</b> nbuf[UTIL_NAME_SIZE], <b>vbuf</b>[UTIL_NAME_SIZE];     // Here, vbuf is defined, however not initialized.</div><div><b>const char</b> *name, <b>*value;        </b>// Here, value is declared to be of type const char *, however, not initialized.<br><b></b></div>... <br>... // some code <br><div>... <br></div><div>switch (token->attr_subst_type) {   // <b>Event 1</b> : This evaluates to SUBST_TYPE_PLAIN</div><div>...</div><div>case <b>SUBST_TYPE_PLAIN</b>:   if (sd_device_get_sysattr_value(dev, name, &value) < 0)   // <b>Event 2</b> :The if condition evaluates to false.<br>                                                 return false;<br> break; </div><div>...// some code<br></div><div>...<br></div><div>}<br></div><div><br></div><div>        if (token->attr_match_remove_trailing_whitespace) {      // <b>Event 4</b>: If condition evaluates to true<br>                if (value != vbuf) {      //  <b>Event 5</b> : vbuf and value are both declared but not initialized. Comparison is done without initializing "vbuf" and "value".</div><div>                        strscpy(vbuf, sizeof(vbuf), value);<br>                        value = vbuf;<br></div><div>                } // End of if.<br></div><div><br></div><div>                delete_trailing_chars(vbuf, NULL);         // <b>Event 6</b>:  trying to delete trailing chars from "vbuf" which is not initialzed. ??<br></div><div>        } // End of outer if.<br></div><div>... // some code</div><div>} /End of function : <b>token_match_attr()</b></div><div><br></div><div>Below are my queries : <br></div><div>1. <b>Event 5 </b>above, we are comparing two resources ("value" and "vbuf") even before initializing them. <br></div><div>    Are we doing this comparision to do decision making based on whether the pointer type variable "value" is pointing to "vbuf" or not. </div><div><b>Query</b>: Kindly confirm whether my understanding is correct.<br></div><div><br></div><div>2. <b>Event 6</b> above, delete_trailing_chars(vbuf, NULL) is called outside  <b>if (value != vbuf).</b></div><div><b>    </b>This implies there may occur a situation where: <br></div><div>              step 1 ) <b>if (value != vbuf) </b>condition fails  --> step 2 ) <b>vbuf</b> is not initialzed inside the <b>if(value != vbuf)  </b>--> step 3 ) delete_trailing_chars(<b>vbuf</b>, NULL).</div><div>Here, delete_trailing_chars() called for "<b>vbuf</b>" which is not necessarily initiazlied.</div><div></div><div><b>Query</b>: Kindly let me know if my understanding is correct or I am missing something. <br></div><div><br></div><div>Thanks, <br></div><div>Amit<br></div><div><br></div><div><b> </b></div></div>