view www/header.html @ 1613:96aa7ec74936 draft

Fix yet another sed bug. The s/// command would copy the \ of substitutions before deciding what to do with them (generally overwriting the \ with the new data). When the substitution was A) at the very end of the new string, B) resolved to nothing, it could leave a trailing \ that didn't belong there and didn't get overwritten because the "copy trailing data" part that copies the original string's null terminator already happened before the \ overwrote it. The ghostwheel() function restarts regexes after embedded NUL bytes, but if the string it's passed is _longer_ than the length it's told then it gets confused (and it means we're off the end of our allocation so segfaults are likely). Fix: test for \ first and move the "copy byte" logic into an else case.
author Rob Landley <>
date Mon, 15 Dec 2014 03:34:55 -0600
parents 859b9bdde999
children 44e86486a57d
line wrap: on
line source

<!-- body style="background: url(toycans.png) repeat;" -->
<table border=0 cellpadding=0 cellspacing=10>

<tr><td valign=top>

    <li><a href="index.html">News</a></li>
    <li>What is it?<br>
      <a href="about.html">About</a><br>
      <a href="roadmap.html">Roadmap</a><br>
      <a href="status.html">Status</a><br>
      <a href="help.html">Help</a><br>

    <li>Why is it?<br>
      <a href="">video</a>/<a href=>outline</a><br>
      <a href="">Interview</a><br>
    <li><a href="/hg/toybox">Mercurial Repository</a></li>
    <li><a href="">Git mirror</a></li>
    <li><a href="downloads">Releases</a></li>
    <li><a href="bin">Binaries</a></li>
    <li><a href="design.html">Design</a></li>
    <li><a href="code.html">Source walkthrough</a></li>
    <li><a href="">Mailing List</a></li>
    <li>IRC #toybox on</li>
    <li><a href="/notes.html">Maintainer's Blog</a></li>
    <li><a href=cleanup.html>Cleanup</a></li>
    <li><a href=>Statistics</a></li>

<td valign=top>